English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I need a program made from C, not C++, that converts length and width in feet to yards then multiplies them to get the area in square yards.

2007-06-28 00:48:04 · 4 answers · asked by marianne m 1 in Computers & Internet Programming & Design

4 answers

#include stdio.h
void main ()
{
float breadth_yard, length_yard,breadth_feet, length_feet, area;
printf("Enter the breadth of rectanglein feet");
scanf("%f",&breadth_feet)
printf("Enter the lenght of rectangle in feet");
scanf("%f",&length_feet);

/* 1 yard is equals to 3 feets */
breadth_yard=breadth_feet/3;
length_yard=length_feet/3;
area=breadth_yard*length_yard;
printf("The area in square yards in feets is %f ",&area)
}

2007-06-28 01:34:59 · answer #1 · answered by Nitin 2 · 0 0

Here's what I think you were asking.
I did not check the C code for correctness, just the formulas to convert the way you wanted.




#include stdio.h
#include conio.h
void main (void)
{
int a;
int b;
int c;
int d;
int e;
printf("Enter the breadth of rectangle in feet");
scanf("%d",&a)
printf("Enter the lenght of rectangle in feet");
scanf("%d",&b);
c=a/3;
d=b/3; /*converting from feet to yards*/
e=c*d;
Printf("The area in square yards is %d ",&e)
}

2007-06-28 01:18:37 · answer #2 · answered by vbmica 7 · 0 0

#include your math packages.
init your routine.
declare x,y,area,ayards as floating point numbers.
input x and y. ' input length and breath in feet.
area = x*y.
ayards =area/9.'there are 9 square feet in 1 square yard.
print ayards.

2007-06-28 01:19:02 · answer #3 · answered by Richard F 7 · 0 0

#include stdio.h
#include conio.h
void main (void)
{
int a;
int b;
int c;
int d;
int e;
printf("Enter the breadth of rectanglein yards");
scanf("%d",&a)
printf("Enter the lenght of rectangle in yards");
scanf("%d",&b);
c=a*3;
d=b*3; /*converting from yard to feet*/
e=c*d;
Printf("The area in square yards in feets is %d ",&e)
}

2007-06-28 01:01:57 · answer #4 · answered by Hussain S 2 · 0 0

fedest.com, questions and answers