Convert Centimeter to feet and inch - C/C++






// Write a program to convert Centimeter to Feet and Inch


#include<stdio.h>
#include<conio.h>
void main()
{
    int cen,centi=0,inch=0,feet=0;
    clrscr();
    printf("Enter Centimeter -> ");
    scanf("%d",&cen);
    if(cen >= 2.5)
    {
        inch=cen/2.5;
        centi=cen-(inch*2.5);
    }
    if(inch>=12)
    {
        feet=inch/12;
        inch=inch%12;
    }
    printf("\n\n%d Feets %d Inches %d Centimeters",feet,inch,centi);
    getch();
}

Post a Comment