Program 1: Basic Text Display
Objective:
To print the name and subject information on the screen using printf()
function.
Program:
#include<stdio.h>
int main(){
printf("Name:Supriyo Chowdhury\n ID:2302149\n");
printf("EEE-124:Computing Methods and Techniques for Engineering Analysis\n");
return 0;
}
Output:
Name:Supriyo Chowdhury
ID:2302149
EEE-124:Computing Methods and Techniques for Engineering Analysis
Flow chart:
Start
Display : Name and ID “EEE 124:
Computing Methoods and
Techniques for Engineering
Analysis
Stop
Discussion and Conclusion :
Discussion- Uses basic printf() for output.- Demonstrates **string printing**
in C without requiring input.- Helps in understanding the fundamental syntax
of C.
Conclusion:This program is useful for displaying static information and
serves as an introduction to basic output formatting in C
Program 2: Addition of Two
Objective: Numbers
To take two numbers as user input and calculate their sum
Program:
#include <stdio.h>
int main()
{
int A,B,sum;
printf("Name:Supriyo Chowdhury\n ID:2302149\n");
printf("Enter the value of A:");
scanf("%d", &A);
printf("Enter the value of B:");
scanf("%d", &B);
sum = A + B;
printf("Sum of A & B: \n A + B = %d", sum);
return 0;
}
Output:
Flowchart:
Start
Display : Name and ID int a = 6 int b =
9
int sum = a + b
Display sum
Stop
Discussion and Conclusion :
Discussion- Uses scanf() to take user input.
- Performs addition using the‘+’operator.
- Demonstrates user interaction with the program.
Conclusion- A basic interactive program that allows users to input two numbers
and calculates the sum dynamically.
Program 3: Multiplication of Two Numbers
Objective: To take two numbers as user input and calculate their product.
Program:
#include <stdio.h>
int main()
{
int num1, num2, product;
printf("Name :Supriyo Chowdhury \n ID: 2302149\n\n");
printf("Enter the Number 1 : ");
scanf("%d", &num1);
printf("Enter the Number 2 : ");
scanf("%d", &num2);
product = num1 * num2;
printf("Product:\n A * B %d", product);
}
Output:
Output:
Name:Supriyo Chowdhury
ID:2302149
Enter the value of A:56
Enter the value of B:85
Sum of A & B:
A + B = 141
Flow chart:
Start
Display : Name and ID int num1 = 56, int
num = 85
int product = a * b
Display product
End
Discussion and Conclusion :
Discussion
- Uses scanf() to take user input.
- Performs multiplication using the ‘*’ operator.- Demonstrates user interaction with
the program.
Conclusion: This program reinforces user input handling and mathematical
operations, demonstrating **multiplication functionality** in C.
Program 4: Area of a Circle
Objective: To compute the area of a circle by given radius.
Program:
#include <stdio.h>
#define pi 3.1416
int main()
{
int r;
printf("Name :Supriyo Chowdhury \n ID: 2302149\n\n");
printf("Input the radius of a circle : ");
scanf("%d", &r);
float area = pi * r * r;
printf("Area of a circle having radius %d is %f", r, area);
return 0;
}
Output:
Name :Supriyo Chowdhury
ID: 2302149
Input the radius of a circle : 12
Area of a circle having radius 12 is 452.390411
Flow chat:
Start
define PI = 3.1416
Display : Name and ID int r = 12
float area = PI * r * r
Display area
End
Discussion and Conclusion :
Discussion:
- Uses #define to define universal constants.
- Handles floating-point arithmetic.
Conclusion :This program demonstrates **mathematical calculations** in C and
highlights how external libraries (math.h) can be used.
Textbook 1.9 : Temperature Conversion (Celsius to Fahrenheit
& Vice Versa)
Objective: To convert temperatures between Celsius and Fahrenheit using
standard formulas.
Program:
#include <stdio.h>
int main()
{
printf("Supriyo Chowdhury \nID: 2302149\n\n");
float in_tem_cel, in_tem_fah, out_tem_cel, out_tem_fah;
// Celsius to Fahrenheit
printf("Celsius --> Fahrenheit\n");
printf("Input a temperature (Celsius): ");
scanf("%f", &in_tem_cel);
out_tem_fah = (9.0 * in_tem_cel / 5.0) + 32;
printf("%.2f°C is equivalent to %.2f°F\n\n", in_tem_cel, out_tem_fah);
// Fahrenheit to Celsius
printf("Fahrenheit --> Celsius\n");
printf("Input a temperature (Fahrenheit): ");
scanf("%f", &in_tem_fah);
out_tem_cel = (in_tem_fah - 32) * 5.0 / 9.0;
printf("%.2f°F is equivalent to %.2f°C\n", in_tem_fah, out_tem_cel);
return 0;
}
Output:
Supriyo Chowdhury
ID: 2302149
Celsius --> Fahrenheit
Input a temperature (Celsius): 25
25.00°C is equivalent to 77.00°F
Fahrenheit --> Celsius
Input a temperature (Fahrenheit): 77
77.00°F is equivalent to 25.00°C
Flow chat:
Start
define PI = 3.1416
Display : Name and ID
float in_tem_cel = 69
float in_tem_fah = 69
float out_tem_cel = (in_tem_cel*9/5) + 32
float out_tem_fah = (in_tem_cel - 32)*5/9
Display temperature
End
Discussion and Conclusion :
Discussion:
- Uses conversion formulas:
- F = (9/5 × C) + 32
- C = (F - 32) × 5/9
Conclusion : This program reinforces user input handling and mathematical operations,
demonstrating **multiplication functionality** in C.
Textbook 1.10 : Area of a Triangle
Objective: To compute the area of a triangle given three sides.
Program:
#include <stdio.h>
#include <math.h>
int main()
{
int a, b, c;
printf("Name : Supriyo Chowdhury \n ID: 2302149\n\n");
printf("Enter side a: ");
scanf("%d", &a);
printf("Enter side b: ");
scanf("%d", &b);
printf("Enter side c: ");
scanf("%d", &c);
float s = (a + b + c) / 2;
float area = sqrt(s * (s - a) * (s - b) * (s - c));
printf("Area of your triangle is %f,", area);
return 0;
}
Output:
Name : Supriyo Chowdhury
ID: 2302149
Enter side a: 8
Enter side b: 5
Enter side c: 7
Area of your triangle is 17.320509
Flow chat:
Start
Display : Name and ID int a = 8 int
b =5 int c = 57
float area = sqrt(s(s-a)(s-b)(s-c))
Display area
End
Discussion and Conclusion :
Discussion:
- Uses math.h for sqrt() function.
- Implements semi-perimeter (s) calculation.
- Handles floating-point arithm
Conclusion : This program demonstrates **mathematical calculations** in C
and highlights how external libraries (math.h) can be used.
Textbook 1.11 : Distance Between Two Points
Objective: To calculate the distance between two points (x1, y1) and (x2, y2) using the
distance formula
Program:
#include <stdio.h>
#include <math.h>
int main()
{
printf("Name :Supriyo Chowdhury\n ID: 2302149\n\n");
float x1, y1, x2, y2, distance;
printf("Enter first co-ordinate,\n x1: ");
scanf("%f", &x1);
printf("y1: ");
scanf("%f", &y1);
printf("Enter second co-ordinate\n, x2: ");
scanf("%f", &x2);
printf("y2: ");
scanf("%f", &y2);
distance = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
printf("Distance between points: %.2f\n", distance);
return 0;
}
Output:
Name :Supriyo Chowdhury
ID: 2302149
Enter first co-ordinate,
x1: 5
y1: 9
Enter second co-ordinate
, x2: 2
y2: 5
Distance between points: 5.00
Flow chat:
Start
Display : Name and ID
int x1 = 1 ,
int y1 = 2 ,int x2 = 8 ,int y2 = 8
float distance = sqrt (pow(x2-x1,2 ) + pow(y2 -y1, 2))
Display distance
End
Discussion and Conclusion :
Discussion:
- Uses #define to define universal constants.
- Handles floating-point arithmetic.
Conclusion :This program demonstrates **mathematical calculations** in C and
highlights how external libraries (math.h) can be used.
Textbook 1.12 : Circle Perimeter & Area Calculation
Objective: To calculate the radius, perimeter, and area of a circle centered at (0,0)
given a point (4,5) on its circumference..
Program:
#include <stdio.h>
#include <math.h>
int main() {
printf("Name :Supriyo Chowdhury \n ID: 2302149\n\n");
float x, y, radius, perimeter, area;
const float PI = 3.1416;
x = 4;
y = 5;
radius = sqrt(pow(x - 0, 2) + pow(y - 0, 2));
perimeter = 2 * PI * radius;
area = PI * pow(radius, 2);
printf("Radius: %.2f\n", radius);
printf("Perimeter of circle: %.2f\n", perimeter);
printf("Area of circle: %.2f\n", area);
return 0;
}
Output:
Name :Supriyo Chowdhury
ID: 2302149
Radius: 6.40
Perimeter of circle: 40.23
Area of circle: 128.81
Flow chat:
Start
define PI = 3.1416
Display : Name and ID
int x = 4
int y =5
float radius =sqrt (pow(x-0,2 ) + pow(y-0, 2))
float perimeter = 2*PI*radius
float area = pi* radius*radius
Display radius perimeter area
End
Discussion and Conclusion :
Discussion:
-Uses distance formula to determine the radius (r).
-Implements circle formulas:
i)Perimeter: C=2πrC = 2\pi r
ii)Area: A=πr2A = \pi r^2
-Demonstrates constant value usage (PI = 3.1416) for precision.
-Essential for geometry-based calculations, graphical modeling, and physics
applications.
Conclusion : This program effectively determines key circle properties,
showcasing how mathematical formulas can be applied dynamically in
computational geometry
Textbook 1.13 : Circle Area Using Diameter
Objective: To compute the diameter, radius, and area of a circle using
two given points on its circumference.
Program:
#include <stdio.h>
#include <math.h>
#define PI 3.1416
int main() {
printf("Name : Supriyo Chowdhury \n ID: 2302149\n\n");
float x1 = 8, y1 = 2, x2 = 7, y2 = 6, diameter, radius, area;
diameter = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
radius = diameter / 2;
area = PI * pow(radius, 2);
printf("Diameter: %.2f\n", diameter);
printf("Radius: %.2f\n", radius);
printf("Area of circle: %.2f\n", area);
return 0;
}
Output:
Name : Supriyo Chowdhury
ID: 2302149
Diameter: 4.12
Radius: 2.06
Area of circle: 13.35
Flow chat:
Start
define PI 3.1416
Display : Name and ID int x1=8, int
y1=2 ,x2=7, y2=6
float area = sqrt(s(s-a)(s-b)(s-c))
Display area
End
Discussion and Conclusion :
Discussion:
- Utilizes the distance formula to determine the circle’s diameter.
-Derives radius from diameter using r=D/2r = D/2.
-Implements area formula A=πr2A = \pi r^2 for precise computation.
-Relevant in computer graphics, engineering simulations, and physics modeling
Conclusion : This program demonstrates how diameter leads to precise area calculation,
reinforcing coordinate geometry and formula application in real-world problem solving