Exercise 1 #include int main() { printf(“Hello C Programming!\n”); return 0; } 1.Run your Visual Studio 2008 or Create a new “project” and add a new C file to the project. 3.Write following simple C code 4.Build 5.Execute
1(a). Write a program that will obtain the length and width of a rectangle from the user and compute its area and perimeter. (Use float type for all variables.) Output Example : ( keyboard user input) ,
1(b). Write a program that reads in the radius(반지름) of a circle and prints the circle’s diameter(지름), circumference(둘레), and area(면적). Use the constant value for PI. #include int main() { float radius, diameter, circumference, area; // put your code here // use scanf to get the value of radius // use printf to display the result of calculation. } Output Example : Get radius? 3.5 ( keyboard user input) diameter = , circumference = , area =
2. Write a program to convert a temperature in degrees Fahrenheit to degrees Celsius. Celsius = 5.0 / 9.0 * (fahrenheit – 32) Input and Output Example : ( keyboard user input)
3. Write a program that predicts the score needed on a final exam to achieve a desired grade in a course. The program should interact with the user as follows: Input and Output Example : Enter desired grade> B Enter minimum average required> 79.5 Enter current average in course> 74.6 Enter how much the final counts as a percentage of the course grade> 25 You need a score of on the final to get a B.
4. Write a program that converts meter-type height into [feet(integer),inch(float)]-type height. Your program should get one float typed height value as a keyboard input and prints integer typed feet value and the rest of the height is represented as inch type. (1m=3.2808ft=39.37inch) (input and output format example) 1.80meter -> 5feet 10.9inch use automatic type conversion 1/2 = 0 (?), 3/2 = 1 (?) (ex) int a; float b; b = 3.6/2.0; a=b; printf(“a=%d, b=%f\n”,a,b);