Write a C program to enter a distance in to kilometre and convert it in to meter, feet, inches and centimetre.
#include <stdio.h>int main(){float km;printf("Enter Length in Kilometer : ");scanf("%f", &km);printf("\n %.2f KM = %.2f Meters", km, km * 1000);printf("\n %.2f KM = %.2f Feets", km, km * 3280.84);printf("\n %.2f KM = %.2f Inches", km, km * 39370.08);printf("\n %.2f KM = %.2f Centimeters", km, km * 1000 * 100);return 0;}
Write a program to compute Fahrenheit from centigrade (f=1.8*c +32)
#include <stdio.h>int main(){float F, C;printf("Enter Temperature in Celsius : ");scanf("%f", &C);F = (C * 1.8) + 32;printf("\n %.2f Celsius = %.2f Fahrenheit", C, F);return 0;}
Write a C program to read a number and check it is even or odd.
#include <stdio.h>int main(){int i;printf("\n Enter any Number : ");scanf("%d", &i);if ((i % 10) % 2 == 0){printf("\n Last Digit of Number is Even");}else{printf("\n Last Digit of Number is Odd");}return 0;}
0 Comments