This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: /*area of circle */ C = PI; R = 5; perimeter = 2.0 *C *R; area = C*R*R; printf("%f, %f",perimeter,area); return(0); } This program will calculate and print the perimeter and area of a circle with radius = 5. 2. #include <stdio.h> #include <math.h> int main(void) { float fDistance1, fDistance2, fDistanceTraveled; float fTime1, fTime2; float fU; float fA; printf(“Please input the first time: ”); scanf(“%f”,&fTime1); printf(“Please input the second time: ”); scanf(“%f”,&fTime2); printf(“Please input the initial velocity: ”); scanf(“%f”,&fU); printf(“Please input the acceleration: ”); scanf(“%f”,&fA); fDistance1=(fU*fTime1)+(0.5*fA*pow(fTime1,2.0)); fDistance2=(fU*fTime2)+(0.5*fA*pow(fTime2,2.0)); fDistanceTraveled = fDistance2fDistance1; printf(“The distance traveled between the time interval is: %8.3f”,fDistanceTraveled); return(0); } 3. i) 7 ii) 3 iii) 6...
View
Full Document
 Spring '07
 Koen
 Mathematical constant

Click to edit the document details