/* This program takes length and
breadth of rectangle and radius of a circle from
user as input then finds area and
perimeter of the rectangle and the circumference of t
he circle, then shows results.*/
#include<stdio.h>
#include<conio.h>
int main()
{
/*Declaring and initializing variables*/
float lengthrect = 0, breadthrect =0, radius =0, area
=0, perimeter =0, circumference =0 ;
/*Taking input from user*/
printf("Please enter the length of Rectangle: ");
scanf("%f",&lengthrect);
printf("\nNow enter the breadth of Rectangle: ");
scanf("%f",&breadthrect);
printf("\nNow enter the radius of circle: ");
scanf("%f",&radius);
/*Calculations*/
area =
lengthrect * breadthrect;
perimeter
= 2 * (breadthrect + lengthrect);
circumference = 2 * 3.1416 * radius;
/*showing results*/
printf("\n\nResults: \n");
printf("__________");
printf("\nArea of the Rectangle: %f units\n",area);
printf("\nPerimeter of the Rectangle: %f units\n",perimeter);
printf("\nCircumference of the circle: %f units \n",circumference);
getche();
return 0;
}
area of cicle is not being calculated by above prog. plz help
ReplyDeletearea of circle can be calculated by giving an instruction i.e;
Deleteaoc=3.14*radius*radius;
because formula is pi.r^2
where pi=3.14
area of circle can be calculated by giving an instruction i.e;
ReplyDeleteaoc=3.14*radius*radius;
because formula is pi.r^2
where pi=3.14
How to do if the program have looping? sorry my english bad
ReplyDeleteHow to do if the program have looping? sorry my english bad
ReplyDeleteProvide your Code here
Delete