0% found this document useful (0 votes)
12 views

RakshithS - PL 3

The document contains the code for a C program that calculates the: 1) Area of a circle by taking user input for radius and using the formula area = πr^2 2) Volume of a sphere, area of a rhombus, square, cylinder and triangle by taking the appropriate user inputs for each shape's properties and applying the relevant formulas to output the calculated areas and volume.

Uploaded by

rakshiths
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

RakshithS - PL 3

The document contains the code for a C program that calculates the: 1) Area of a circle by taking user input for radius and using the formula area = πr^2 2) Volume of a sphere, area of a rhombus, square, cylinder and triangle by taking the appropriate user inputs for each shape's properties and applying the relevant formulas to output the calculated areas and volume.

Uploaded by

rakshiths
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

8. WAP to find Area of a circle.

/* 8.Write a program to find area of circle.


Author Name:RakshithS
Date Written:20.08.2023
Date Compiled:22.08.2023
*/
#include<stdio.h>
#include<conio.h>
void main()
{

float a,r;
printf("enter the r value:");
scanf("%f",&r);
a=3.14*r*r;
printf("area of circle is %f",a);
getch();

OUTPUT:
9. WAP to find
a. Volume of a sphere
b. Area of a sphere
c. Area of a square
d. Area of a Cylinder
e. Area of a Triangle

/* 9.Write a program to find


a. Volume of sphere
b. Area of rhombus
c. Area of square
d. Area of cylinder
e. Area of traingle
Author Name:RakshithS
Date Written:20.08.2023
Date Compiled:22.08.2023
*/
#include<stdio.h>
#include<conio.h>
void main()
{

float v,r; /* variables to find volume of sphere */


float d1,d2,arhombus; /* variables to find area of rhombus */
float asquare,a; /*variables to find area of square */
float rcylinder,h,acylinder;
float atraingle,base, height; /* variables to find the area of traingle*/ clrscr();
printf("a.to find volume of a sphere\n");
printf("enter the r value:");
scanf("%f",&r);
v=1.33*3.14*r*r*r;
printf("volume of sphere is %f\n",v);
getch();

printf("b.to find the area of rhombus\n");


printf("enter the d1 value:\n");
scanf("%f",&d1);
printf(" enter the d2 value:\n");
scanf("%f",&d2);
arhombus=0.5*d1*d2;
printf("area of rhombus is %f\n",arhombus);

printf("c.to find area of square\n");


printf("enter the side of a square : ");
scanf("%f",&a);
asquare=a*a;
printf("area is square is %f\n",asquare);

printf("d.to find the area of cylinder\n");


printf("enter the rcylinder value:\n");
scanf("%f",&rcylinder);
printf(" enter the h value:\n"); scanf("%f",&h);
acylinder=3.14*rcylinder*rcylinder*h;
printf("area of cylinder is %f\n",acylinder);

printf("e.to find the area of traingle\n");


printf("enter the base value:\n");
scanf("%f",&base);
printf(" enter the height value:\n");
scanf("%f",&height);
atraingle=0.5*base*height;
printf("area of traingle is %f\n",atraingle);

getch();

OUTPUT:

You might also like