Homework 1 (8/30)
/* Program to convert 1 meter to miles */
#include <stdio.h>
#include <math.h>
int main(void)
{
/* Declare and initialize variables. */
double meter1=5, mile1=1609.344, output1;
/* Conversion of units. */
output1=meter1/mile1;
/* Print conversion. */
printf("approximately ""%8.9f miles ",output1);
/* Exit program. */
return 0;
}
![]() |
| Meters to miles input & output |
------------------------------------------------------------------
/* Program to convert 1 meter to miles */
#include <stdio.h>
#include <math.h>
int main(void)
{
/* Declare and initialize variables. */
double TempR, TempC=25;
/* Conversion of units. */
TempR= (TempC+273.15)*1.8;
/* Print conversion. */
printf("The entered Celcius is about""%8.3f degrees ",TempR);
/* Exit program. */
return 0;
}
![]() |
| Celsius to Rankine input & output |
/* Program to compute area of an ellipse */
#include <stdio.h>
#include <math.h>
int main(void)
{
/* Declare and initialize variables. */
double Area, a=5, b=6;
/* Computation. */
Area= M_PI*a*b;
/* Print area. */
printf("The area of the ellipse is about"" %6.3f",Area);
/* Exit program. */
return 0;
}
![]() |
| Area of an ellipse input & output |
/* Program to compute area of a sector of a circle */
#include <stdio.h>
#include <math.h>
int main(void)
{
/* Declare and initialize variables. */
double Area, r=5, d=40;
/* Computation. */
Area= (M_PI*pow(r,2))*(d/360);
/* Print area. */
printf("The area of the sector is about"" %5.3f",Area);
/* Exit program. */
return 0;
}
![]() |
| Area of a sector of a circle input & output |
-------------------------------------------------------------------




Comments
Post a Comment