0% found this document useful (0 votes)
7 views6 pages

Prac 2

The document outlines a practical activity for calculating the areas of various geometric shapes using C programming. It includes sample inputs, processes, and outputs for the triangle, parallelogram, rhombus, and trapezoid. Additionally, it provides algorithms, flowcharts, and code examples for each shape's area calculation.

Uploaded by

dua186641
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)
7 views6 pages

Prac 2

The document outlines a practical activity for calculating the areas of various geometric shapes using C programming. It includes sample inputs, processes, and outputs for the triangle, parallelogram, rhombus, and trapezoid. Additionally, it provides algorithms, flowcharts, and code examples for each shape's area calculation.

Uploaded by

dua186641
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/ 6

SLO No 9.2.

2
SLOs Mapped 8.3.2, 9.1.1,9.1.2,9.1.3,9.1.5,9.2.2,9.2.3,9.2.4
Practical Activity To find the area of a triangle, parallelogram, rhombus and trapezoid
Equipment Computer
Software Dev C++

Practical No 2
Topic 9: Fundamental of input and output data handling in C
Objective:
Students will be able to
use the arithmetic operators and input output data handling in C language to solve the given
arithmetic problem.
Note: You can use any compiler for program execution.

Area of Triangle
Sample Input Process Sample Output
Base = 8
Area = 0.5 * base * height Area of Triangle = 38
Height = 9.5

Area of Parallelogram
Sample Input Process Sample Output
Height = 5
Area = base * height Area of Parallelogram = 40
Base = 8

Area of Rhombus
Sample Input Process Sample Output
Diagonal1 = 4.2
Area = 0.5 * diagonal1 * diagonal2 Area of Rhombus = 7.56
Diagonal2 = 3.6

Area of Trapezoid
Sample Input Process Sample Output
Base1 = 6.5
Base2 = 5.3 Area = 0.5 * height * (base 1 + base 2) Area of Trapezoid = 23.6
Height = 4

Fill the sections below as evidence of the practical activity.

3
Computer Science Practical: X

Area of Triangle
Algorithm Flowchart
Step1: Start

Let the height is 9.5 and Bace is 8

Step2: Calculate the Area

Area = 0.5 * base * height

Step3: Output Area

Step4: Stop

Code Output
#include <stdio.h>
#include <math.h>
int main ()
{
float base, Area, height;

printf ("enter the base:");


scanf ("%f", & base);

printf ("enter the height:");


scanf ("%f", & height);

Area = 0.5 * base * height;


Printf ("Area of Triangle: %f", Area);

return 0;

4
Computer Science Practical: X

Area of Parallelogram
Algorithm Flowchart
Step1: Start

Let the height is 5 and bace is 8

Step2: Calculate the Area

Area=b*h
Step3: Output Area

Step4: Stop

Code Output
#include <stdio.h>
#include <math.h>
int main ()
{
float base, Area, height;

printf ("enter the base:");


scanf ("%f", & base);

printf ("enter the height:");


scanf ("%f", &height);

Area = base * height;


Printf ("Area of Parallelogram: %f", Area);

return 0;

5
Computer Science Practical: X

Area of Rhombus
Algorithm Flowchart
Step1: Start
Let the d1 is 4.2 and d2 is 3.6
Step2: Calculate the Area

Area=0.5*d1*d2
Step3: Output Area
Step4: Stop

Code Output

#include <stdio.h>
#include <math.h>
int main ()
{
float Diagonal1, Diagonal2, Area;

printf ("enter the Diagonal1:");


scanf ("%f", &Diagonal1);

printf ("enter the Diagonal2:");


scanf ("%f", &Diagonal2);

Area = 0.5 * Diagonal1 * Diagonal2;


Printf ("Area of Rhombus: %f", Area);

return 0;

6
Computer Science Practical: X

7
Computer Science Practical: X

Area of Trapezoid
Algorithm Flowchart
Step1: Start
Let the b1 6.5 is and b2 is 5.3 and h is4
Step2: Calculate the Area

Area=0.5*b1*b2*h
Step3: Output Area
Step4: Stop

Code Output
#include <stdio.h>
#include <math.h>
int main ()
{
float Base1, Base2, Height, Area;

printf ("enter the Base1:");


scanf ("%f", &Base1);

printf ("enter the Base2:");


scanf ("%f", &Base2);

printf ("enter the Height:");


scanf ("%f", &Height);

Area = 0.5 * Height * (Base1 + Base2);


Printf ("Area of Trapezoid: %f", Area);

return 0;

You might also like