Input
distance in kilometers and write a program to convert this distance in meters,
feet, inches and centimeters.
#include <stdio.h>
#include <conio.h>
void main ( )
{
float km, m, cm, ft, inch;
clrscr ( );
printf ("\n Enter the distance in kilometers : -"); scanf ("%f",&km);
m = km * 1000;
cm = m * 100;
inch = cm / 2.54;
f t= inch / 12;
printf ("\n Distance in meters : - %f", m);
printf ("\n Distance in centimeters : - %f", cm);
printf ("\n Distance in inches : - %f", inch);
printf ("\n Distance in feet : - %f", ft);
getch ( );
}
#include <conio.h>
void main ( )
{
float km, m, cm, ft, inch;
clrscr ( );
printf ("\n Enter the distance in kilometers : -"); scanf ("%f",&km);
m = km * 1000;
cm = m * 100;
inch = cm / 2.54;
f t= inch / 12;
printf ("\n Distance in meters : - %f", m);
printf ("\n Distance in centimeters : - %f", cm);
printf ("\n Distance in inches : - %f", inch);
printf ("\n Distance in feet : - %f", ft);
getch ( );
}
A
student get marks in eight different subjects are input through keyboard, find
out the total marks and percentage marks get by the student. Assume that the
maximum marks that can be get by a student in each subject is hundred.
#include <stdio.h>
#include <conio.h>
void main ( )
{
int m1, m2, m3, m4, m5, m6, m7, m8, tot;
float per;
clrscr ( );
printf ("\n Enter marks in eight different subject : -");
scanf ("%d %d %d %d %d %d %d %d",&m1, &m2, &m3, &m4, &m5, &m6, &m7, &m8);
tot = m1 + m2 + m4 + m5 + m6 + m7 + m8;
per = tot / 8;
printf ("\n Total marks is : - %d", tot);
printf ("\n Percentage is : - %f", per);
getch ( );
}
Click here to contact us
#include <conio.h>
void main ( )
{
int m1, m2, m3, m4, m5, m6, m7, m8, tot;
float per;
clrscr ( );
printf ("\n Enter marks in eight different subject : -");
scanf ("%d %d %d %d %d %d %d %d",&m1, &m2, &m3, &m4, &m5, &m6, &m7, &m8);
tot = m1 + m2 + m4 + m5 + m6 + m7 + m8;
per = tot / 8;
printf ("\n Total marks is : - %d", tot);
printf ("\n Percentage is : - %f", per);
getch ( );
}
Click here to contact us
No comments:
Post a Comment