0% found this document useful (0 votes)
63 views21 pages

Assignment - 1 (EEE-124)

The document outlines several C programming exercises, each with objectives, program flow charts, discussions, and conclusions. Programs include basic text display, addition and multiplication of numbers, area calculations for geometric shapes, and temperature conversions. Each program reinforces fundamental programming concepts and mathematical operations in C.

Uploaded by

u2302007
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)
63 views21 pages

Assignment - 1 (EEE-124)

The document outlines several C programming exercises, each with objectives, program flow charts, discussions, and conclusions. Programs include basic text display, addition and multiplication of numbers, area calculations for geometric shapes, and temperature conversions. Each program reinforces fundamental programming concepts and mathematical operations in C.

Uploaded by

u2302007
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/ 21

Program 1 : Basic Text Display

OBJECTIVE

To print the name and subject information on the screen using printf() function.

Program

Output

FLOW CHART

START

DISPLAY NAME AND ID


“EEE 124: COMPUTATIONAL
METHOD 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
infor mation and serves as an introduction to basic
output for matting in C.
Program 2: Addition of Two Numbers

OBJECTIVE

To take two number as user input and calculate their sum

PROGRAM

OUTPUT
FLOW CHART
START

Display : Name and ID


int A=5
int B= 6

int sum = A+B

Display product

STOP

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 3: Multiplication of Two Numbers

OBJECTIVE
To take two numbers as user input and calculate their product.

PROGRAM

Output
FLOW CHART
START

Display:Name and ID
int A=4
int B=7

int product=A*B

Display product

STOP

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

OUTPUT
FLOW CHART START

DEFINE PI 3.1416

DISPLAY : NAME AND


ID
float r=07

float area=PI*r*r

DISPLAY
AREA

STOP

DISCUSSION AND
CONCLUSION :

Discussion:
- Uses #define to define universal constants
-Handels floating-point arithmetic.

Conclusion:
This program demonstrates ‘mathematical calculation’
in C and highlights how exter nal 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
OUTPUT

FLOW CHART
START

Display : Name and ID


float in_tem_cel= 07
float in_tem_fah = 07

float out_tem_cel = (f1*9/5) + 32


float out_tem_fah = (c1 - 32)*5/9

Display temperature

STOP
Discussion and Conclusion :

Discussion:
- Uses conversion for mulas:
- F = (9/5 × C) + 32
- C = (F - 32) × 5/9
-Implements floating-point calculations** (%f for
scanf().

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

OUTPUT
FLOW CHART START

Display : Name and ID


int a = 6
int b =7
int c = 8

float area = sqrt(s(s-a)(s-b)(s-c))

Display area

STOP
DISCUSSION AND
CONCLUSION :

Discussion:
- Uses math.h for sqrt() function.
- Implements semi-perimeter (s) calculation.
- Handles floating-point arithmetic.

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

OUTPUT
FLOW CHART
START

DISPLAY : NAME AND ID


int x1 = 2
int y1 = 3
int x2 = 4
int y2 = 7

float distance = sqrt (pow(x2-x1,2 ) + pow(y2 -y1, 2))

DISPLAY
DISTANCE

STOP

Discussion and Conclusion :

Discussion:
-Uses coordinate geometry principles for calculating distance.
-Implements the sqrt() and pow() functions from math.h.
-Ensures correct user input handling using scanf() for real-time
calculations.
-This concept is widely used in graphics programming, physics, and
navigation systems.

Conclusion:
This program correctly computes the Euclidean distance, enhancing spatial
calculations that are crucial in engineering and real-world applications.
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

OUTPUT
FLOW CHART

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

STOP
Discussion and
Conclusion :

Discussion:
-Uses distance for mula to deter mine the radius (r).
-Implements circle for mulas:
-Perimeter: C=2πr
-Area: A=π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 deter mines key circle
properties, showcasing how mathematical for mulas 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

OUTPUT
FLOW CHART

START

DEFINE PI= 3.1416

DISPLAY : NAME AND ID


int x1= 2
int y1 =2
int x2= 5
int y2= 6

float diameter = sqrt (pow(x2-x1,2 ) + pow(y2-y1, 2))


float radius = diameter / 2
float area = PI*radius*radius

DISPLAY
RADIUS
PERIMETER
AREA

STOP
Discussion and Conclusion :

Discussion:
-Utilizes the distance for mula to deter mine the circle’s
diameter.
-Derives radius from diameter using r=D/2r = D/2.
-Implements area for mula 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
for mula application in real-world problem solving.

You might also like