Docstoc

This program is to accept a size in US unit_feet_inch_ from

Document Sample
 This program is to accept a size in US unit_feet_inch_ from Powered By Docstoc
					// This program is to accept a size in US unit(feet,inch) from keyboard and convert to centimetre.
// Written By: Natchanun Kowwarin
// Date: June 29, 2009

#include<stdio.h>
#define inch_ 12
#define feet_ 2.54
int main()
{
int feet, inch;
float sum_feet, sum_feet1, sum_inch, total;

// Prompt user to enter the first integer.
printf("Enter feet: ");
scanf("%d",&feet);

// Prompt user to enter the second integer.
printf("Enter inches: ");
scanf("%d",&inch);

sum_feet = feet * inch_;
printf("%d feet = %.0f inch.\n",feet,sum_feet);

sum_feet1 = sum_feet * feet_;
printf("%.0f inch = %.2f cm.\n\n",sum_feet,sum_feet1);

sum_inch = inch * feet_;
printf("%d inch = %.2f cm.\n\n",inch,sum_inch);

total = sum_feet1 + sum_inch;

printf("%d' %d\" = %.2f cm.\n",feet,inch,total);
return 0;
}// main

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:6
posted:12/29/2011
language:
pages:1