You are on page 1of 4

KEVIN K R #FMT

Ex.no: 1 Program comprising of I/O statements,


Date:
operators and expressions

Ex.no: 1(A): AREA OF CIRCLE

AIM:
To write a C Program for finding the area of a Circle.

ALGORITHM:
Step 1: Start the program.
Step 2: Include the header files.
Step 3: Assign required variables namely r, a.
Step 4: Obtain the input value for r (radius).
Step 5: Calculate the area by using the formula a=3.14 x r x r.
Step 6: Print the result value.
Step 7: Stop the Program.

PROGRAM:
#include<stdio.h>
#include<conio.h>
void main()
{
int r;
float a;
clrscr();
printf("Enter the value of Radius:");
scanf("%d",&r);
a=3.14*r*r;
printf("The Area of the Circle is:%f",a);
getch();
}

22UCS102 - PROGRAMMING IN C LABORATORY


KEVIN K R #FMT

OUTPUT:
Enter the value of Radius:
14
The Area of the Circle is: 615.440002.

RESULT:
Thus, the C program for finding the area of circle is executed and the output is verified successfully.

22UCS102 - PROGRAMMING IN C LABORATORY


KEVIN K R #FMT

Ex.no: 1(B): SIMPLE INTEREST CALCULATION

AIM:
To write a C Program to perform a Simple Interest Calculation.

ALGORITHM:
Step 1: Start the program.
Step 2: Include the header files.
Step 3: Assign required variables namely, p, r, t, a.
Step 4: Get the input values of p, r, t (principal amount, rate of interest and time respectively).
Step 5: Calculate the Simple Interest by using the formula (p x r x t)/100.
Step 6: Print the result value.
Step 7: Stop the Program.

PROGRAM:
#include<stdio.h>
#include<conio.h>
void main()
{
float p,r,t,a;
clrscr();
printf("Enter the value of Principal amount:");
scanf("%f",&p);
printf("Enter the Rate of Interest:");
scanf("%f",&r);
printf("Enter the Time value:");
scanf("%f",&t);
a=(p*r*t)/100;
printf("Simple Interest:%f",a);
getch();
}

22UCS102 - PROGRAMMING IN C LABORATORY


KEVIN K R #FMT

OUTPUT:
Enter the value of Principal amount: 1200
Enter the Rate of Interest : 4
Enter the Time value: 5
Simple Interest: 240.000000

RESULT:
Thus, the C program for determining the Simple Interest is executed and the output is verified successfully.

22UCS102 - PROGRAMMING IN C LABORATORY

You might also like