A Solution to Some C Simple Questions
Introduction
A friend asked me about some questions of C language, which are typical calculations and typesetting usages, from a so-called experiment. I am trying to solve all of them.
Questions & Solutions
Q1. Program to find the perimeter and area of a rectangle from inputting the length and width of the rectangle
Analysis to Q1
This question is intended for training the usages of input and output. For seeing difference, a calculation is required.
Solution to Q1
The code is a solution on Visual C++ 6.0.
1 |
|
Q2. Write a program to “rotate” the capital A
to the lowercase a
Analysis to Q2
First we should comprehend what “rotate” means. We suppose that it means transform. Then, we know that it should be about the process of a sentence, or a string. Last, it is enough for a computer to find all capital "A"s one by one.
Solution to Q2
1 |
|
Q3. Given the radius of the circle r = 2.5 and the height of the cylinder h = 1.8, calculate the surface area and volume of the cylinder
Analysis to Q3
It is easy to know the surface area of a cylinder is derived from and the volume of it is from Hence, it is very easy to program.
Solution to Q3
1 |
|
A Solution to Some C Simple Questions
https://lucisurbe.pages.dev/2020/04/25/A-Solution-to-Some-C-Simple-Questions/