/* Convert Km to Meter, Centimeter or Millimeter */
#include<stdio.h>
int main()
{
float km;
char vi;
float res;
printf("K.M. : ");
scanf("%f",&km);
printf("Change KM in (M,s,m) : ");
fflush(stdin);
scanf("%c",&vi);
if(vi=='M')
res=km*1000;
if(vi=='s')
res=km*100000;
if(vi=='m')
res=km*1000000;
printf("Answer : %.2f",res);
return 0;
}
#include<stdio.h>
int main()
{
float km;
char vi;
float res;
printf("K.M. : ");
scanf("%f",&km);
printf("Change KM in (M,s,m) : ");
fflush(stdin);
scanf("%c",&vi);
if(vi=='M')
res=km*1000;
if(vi=='s')
res=km*100000;
if(vi=='m')
res=km*1000000;
printf("Answer : %.2f",res);
return 0;
}
Bhuvan Arora
No comments:
Post a Comment