C language
Create the following programs:
Program to solve for Area of Rectangle
Variable inputs for length and width of integer data type
Variable output for area of integer data type
Program to find Area of Circle
variable array with 10 inputs from 3-30 by steps of 3
variable array with 10 solutions for Area of Circle of float data type
Program to solve for any angle with inputs of x and y using the standard Cartesian coordinate system
Use math.h library
Solve for output angle of float data type
Use hard coded input variables, and then use printf to output the solutions.
#include <stdio.h> int main() { int length, width; printf("Enter length of rectangle: "); scanf("%d", &length); printf("Enter width of rectangle: "); scanf("%d", &width); printf("Area is %d\n", length*width); return 0; }
#include <stdio.h> #define PI 3.14159 int main() { int radius[10] = {3, 6, 9, 12, 15, 18, 21, 24, 27, 30}, i; double areas[10]; for (i = 0; i < 10; ++i) { areas[i] = PI * radius[i] * radius[i]; } // print result for (i = 0; i < 10; ++i) { printf("Area of circle with radius %d is %lf\n", radius[i], areas[i]); } return 0; }
Get Answers For Free
Most questions answered within 1 hours.