5. Write a C program to enter a distance in to kilometre and convert it in to meter, feet, inches and centimetre

#include<stdio.h>
#include<conio.h>
void main()
{
int km,m,feet,inch,cm;
printf("Enter km=");
scanf("%d",&km);
m=km*1000;
feet=km*30*100000;
inch=km*(2.54)*100000;
cm=km*100000;
printf("m=%d\n feet=%d\n inch=%d\n cm=%d\n",m,feet,inch,cm);
getch();
}

#Output:


Comments

Popular posts from this blog

12. Write a program to read marks from keyboard and your program should display equivalent grade according to following table(if else ladder) Marks Grade 100 - 80 Distinction 79 - 60 First Class 59 - 40 Second Class < 40 Fail