0% found this document useful (0 votes)
2 views11 pages

Assignment

The document contains a series of C programming examples authored by MD. TASNIMUL HASAN PLABON, each demonstrating different mathematical calculations such as summation, area, and perimeter for various shapes. Each program includes user input and output examples, showcasing the functionality of the code. The programs cover calculations for rectangles, squares, triangles, circles, and cylinders.

Uploaded by

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

Assignment

The document contains a series of C programming examples authored by MD. TASNIMUL HASAN PLABON, each demonstrating different mathematical calculations such as summation, area, and perimeter for various shapes. Each program includes user input and output examples, showcasing the functionality of the code. The programs cover calculations for rectangles, squares, triangles, circles, and cylinders.

Uploaded by

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

BH/*Programming No.

:01*/
/*Program to calculate the summation of two number*/
/*Programmer Name: MD.TASNIMUL HASAN PLABON*/
/*Programmer ID:2207317*/
#include<stdio.h>
#include<conio.h>
#include<math.h>

void main ()
{
float a,b,result;
clrscr ();
printf("\n\n Enter the value of first number;");
scanf("%f",&a);
printf("\n\n Enter the value of second number;");
scanf("%f",&b);
result=a+b;
printf("\n\n The summation of the two numbers=%f",result);
printf("\n\n Press any key to exit......");
getch ();
}
Input: Enter the value of first number 3
Enter the value of second number 8

Output: The summation of the two numbers=11


Press any key to exit
/*Programming No.: 02*/

/*Program to calculate area of a rectangle from given two sides*/

/*Programmer name: MD.TASNIMUL HASAN PLABON*/

/*Programmer ID:2207317*/

#include<stdio.h>

#include<conio.h>

#include<math.h>

void main ()

clrscr ( );

float length,width,area;

printf("\n\n Enter the value of length;");

scanf("%f",&length);

printf("\n\n Enter the value of width;");

scanf("%f",&width);

area=length*width;

printf("\n\n The area is=%f",area);

printf("\n\n Press any key to exit.....");

getch ();

Input:Enter the value of length 5

Enter the value of width 2

Output:The area is 10

Press any key to exit


/*Programming No.:03*/
/*Program to calculate the perimeter of a rectangle from given two sides*/
/*Programmer Name: MD.TASNIMUL HASAN PLABON*/
/*Programmer ID:2207317*/
#include<stdio.h>
#include<conio.h>
#include<math.h>

void main ()
{
float length,width,perimeter;
clrscr ();
printf("\n\n Enter the value of length;");
scanf("%f",&length);
printf("\n\n Enter the value of width;");
scanf("%f",&width);
perimeter=2*(length+width);
printf("\n\n The perimeter of the rectangle is=%f",perimeter);
printf("\n\n Press any key to exit......");
getch ();
}

Input:Enter the value of length 6


Enter the value of width 4
Output:The perimeter is 20
Press any key to exit
/*Programming No.:04*/
/*Program to calculate the perimeter of a square from given area*/
/*Programmer Name: MD.TASNIMUL HASAN PLABON*/
/*Programmer ID:2207317*/
#include<stdio.h>
#include<conio.h>
#include<math.h>

void main()
{
clrscr();
float area,length,perimeter;
printf("\n\n Enter the value of area;");
scanf("%f",&area);
length=sqrt(area);
perimeter=4*length;
printf("\n\n the perimeter is=%f",perimeter);
printf("\n\n Press any key to exit.....");
getch();
}

Input:Enter the value of area 25

Output:The perimeter is 20
Press any key to exit
/*Programming No.:05*/

/*Program to calculate the perimeter of a right angled triangle from given height & area*/

/*Programmer Name: MD.TASNIMUL HASAN PLABON*/

/*Programmer ID:2207317*/

#include<stdio.h>

#include<conio.h>

#include<math.h>

void main ()

float a,b,c,area,perimeter;

clrscr ();

printf("\n\n Enter the value of area;");

scanf("%f",&area);

printf("\n\n ENter the value of a:");

scanf("%f",&a);

b=2*area/a;

c=sqrt((a*a)+(b*b));

perimeter=a+b+c;

printf("\n\n The perimeter is=%f",perimeter);

printf("\n\n Press any key to exit......");

getch ();

Input:Enter the value of area 100

Enter the value of a 10

Output:The perimeter is 22.36

Press any key to exit


/*Programming No.:06*/
/*Program to calculate the area of a right angled triangle from given height & area*/
/*Programmer Name: MD.TASNIMUL HASAN PLABON*/
/*Programmer ID:2207317*/
#include<stdio.h>
#include<conio.h>
#include<math.h>

void main ()
{
float a,b,c,area;
clrscr ();
printf("\n\n Enter the value of a;");
scanf("%f",&a);
printf("\n\n Enter the value of c;");
scanf("%f",&c);
b=sqrt((c*c)-(a*a));
area=(a*b)/2.0;
printf("\n\n The area is=%f",area);
printf("\n\n Press any key to exit....");
getch ();
}
Input:Enter the value of a 5
Enter the value of c 6

Output:The area is 8.29


Press any key to exit.
/*Programming No.:07*/
/*Program to calculate theb area of a circle from given diameter*/
/*Programmer Name: MD.TASNIMUL HASAN PLABON*/
/*Programmer ID:2207317*/
#include<stdio.h>
#include<conio.h>
#include<math.h>
#define PI 3.1416

void main ()
{
float d,area;
clrscr ();
printf("\n\n Enter the value of d;");
scanf("%f",&d);
area=PI*d*d;
printf("\n\n The area of the circle is=%f",area);
printf("\n\n Press any key to exit......");
getch ();
}

Input:Enter the value of d 5

Output:The area of the circle is 78.54


Press any key to exit.
/*Programming No.:08*/
/*Program to calculate the circumference of circle from given area*/
/*Programmer Name: MD.TASNIMUL HASAN PLABON*/
/*Programmer ID:2207317*/
#include<stdio.h>
#include<conio.h>
#include<math.h>
#define PI 3.1416

void main ()
{
float r,area,circumference;
clrscr ();
printf("\n\n Enter the value of area;");
scanf("%f",&area);
r=sqrt(area/PI);
circumference=2*PI*r;
printf("\n\n The circumference is=%f",circumference);
printf("\n\n Press any key to exit.....");
getch ();
}
Input:Enter the value of area 25

Output:The circumference is 17.72


Press any key to exit
/*Programming No.:09*/
/*Program to calculate the circumference of circle from given diameter*/
/*Programmer Name: MD.TASNIMUL HASAN PLABON*/
/*Programmer ID:2207317*/
#include<stdio.h>
#include<conio.h>
#include<math.h>
#define PI 3.1416

void main ()
{
float d,circumference;
clrscr ();
printf("\n\n Enter the value of d;");
scanf("%f",&d);
circumference=PI*d;
printf("\n\n The circumference is=%f",circumference);
printf("\n\n Press any key to exit.......");
getch ();
}
Input:Enter the value of d 6
Output:The circumference 18.8496
Press any key to exit
/*Programming No.:10*/
/*Program to calculate the area of cylinder from given radious & height*/
/*Programmer Name: MD.TASNIMUL HASAN PLABON*/
/*Programmer ID:2207317*/
#include<stdio.h>
#include<conio.h>
#include<math.h>
#define PI 3.1416

void main ()
{
float h,r,area;
clrscr ();
printf("\n\n Enter the value of r;");
scanf("%f",&r);
printf("\n\n Enter the value of h;");
scanf("%f",&h);
area=2*PI*r*(r+h);
printf("\n\n The area is=%f",area);
printf("\n\n Press any key to exit......");
getch ();

Input:Enter the value of r 10


Enter the value of h 5
Output:The area is 942.48
Press any key to exit

You might also like