Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
4 views7 pages

Week 1 Program

The document outlines three C programs: one for calculating the area and circumference of a circle, another for finding the volume of a sphere, and a third for calculating simple interest. Each section includes an aim, algorithm, flowchart, program code, and confirms successful execution of the program. The algorithms and code snippets demonstrate basic mathematical operations using user-defined input values.
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)
4 views7 pages

Week 1 Program

The document outlines three C programs: one for calculating the area and circumference of a circle, another for finding the volume of a sphere, and a third for calculating simple interest. Each section includes an aim, algorithm, flowchart, program code, and confirms successful execution of the program. The algorithms and code snippets demonstrate basic mathematical operations using user-defined input values.
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/ 7

Ex.

No -1A,B(i) Area And Circumference of a Circle


Aim:
To develop a C program to find the area and circumference of a circle of given radius
Algorithm:
1. Start
2. Read r value
3. Define pi=3.14
4. area=pi*r*r
5. circumference=2*pi*r
6. Print area, circumference value
7. Stop

Flowchart:

Start

Read‘r’value

Area=pi*r*r
Circumference=2*pi*r

Print area and


circumference

Stop
Program:
#include<stdio.h>
#include<conio.h>

void main()

{ int rad;
float PI=3.14, area, ci;
clrscr();
printf("\nEnter radius of circle:");
scanf("%d", &rad);

area=PI* rad * rad;


printf("\n Area of circle :%f",area);

ci = 2 * PI * rad;
printf("\n Circumference:%f",ci);

getch();
}
Output:

Result:
The C program was executed successfully.
Ex.No -1A,B(ii) Volume of a Sphere

Aim:
To develop a C program to find the volume of a sphere of given radius.
Algorithm:
1. Start
2. Read r value
3. Define pi=3.14
4. volume=4/3*pi*r*r*r
6. Print volume
7. Stop
Flowchart:

Start

Read the Radius

Volume=4/3*pi*r*r*r

Print volume

Stop
Program:
*Source code to Find the volume of a sphere of given radius */
#include<stdio.h>
#include<conio.h>
void main(){
float vol;
int rad;
clrscr();
rad=scanf(“%d”,&rad);
vol=((4.0/3.0)*(3.1415)*rad*rad*rad);
printf("the volume of a sphere is %f",vol);
getch();
}
Output:

Result:
The C program was executed successfully.
Ex.No -1A,B(iii) Find the Simple Interest

Aim:
To develop a C program to find the interest on a given principle for a given period of
time at a given rate of interest per year
Algorithm:
1. Start
2. Read p,t,r values
3. si=(p*t*r)/100
6. Print si(Simple Interest) value
7. Stop
Flowchart:

Start

Read the
p,t,r,values

si=(p*t*r)/100

Print si value

Stop
Program:
*Source code to find the interest of a given principle for a given period of time at a
given rate of interest per year*/

#include<stdio.h>

#include<conio.h>

void main()
{
float principle, rate, sinterest;

int time;
clrscr();
printf("Enter Principle Amount, Rate per Annual and Time\n");

scanf ("%f %f %d", &principle, &rate, &time);


sinterest=(principle* rate*time)/ 100.0;
printf("PrincipleAmount=%5.2f\n",princple);

printf ("Rate per Annum= %5.2f\n",rate);

printf ("Time= %d years\n", time);


printf("SimpleInterest=%5.2f\n",sinterest);
getch();
}
Output:

Result:
The C program was executed successfully.

You might also like