0% found this document useful (0 votes)
6 views

C PROGRAM 1(C,D) PROGRAM (2)

The document provides two programming exercises: one for calculating the area and circumference of a circle, and another for calculating simple and compound interest. The first program prompts the user for the radius and computes the area and circumference using defined formulas. The second program reads the principal amount, time, and rate to compute and display both simple and compound interest.

Uploaded by

sunitha.sagee
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

C PROGRAM 1(C,D) PROGRAM (2)

The document provides two programming exercises: one for calculating the area and circumference of a circle, and another for calculating simple and compound interest. The first program prompts the user for the radius and computes the area and circumference using defined formulas. The second program reads the principal amount, time, and rate to compute and display both simple and compound interest.

Uploaded by

sunitha.sagee
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

I/O STATEMENTS, OPERATORS, EXPRESSIONS

EX.NO : 1(C) AREA AND CIRCUMFERENCE OF A CIRCLE


DATE:

AIM:
To write program to find area and circumference of a circle
ALGORITHM:
1. Start.
2. Initialize the variable radius with a given value.
3. Calculate the area of the circle using the formula: area = pi * radius * radius.
4. Calculate the circumference of the circle using the formula: circumference = 2
* pi * radius.
5. Print the area and circumference.
6. End

PROGRAM :
#include <stdio.h>
#define PI 3.14159
int main() {
float radius, area, circumference;
//Prompt user to enter the radius of circle
printf("Enter the radius of the circle: ");
scanf("%f", &radius);
// Calculate area and circumference of circle
area = PI * radius * radius;
circumference = 2 * PI * radius;
// Print are and circumference of circle
printf("Area of the circle: %.2f\n", area);
printf("Circumference of the circle: %.2f\n", circumference);
return 0;
}
Output:
Enter the radius of the circle: 2
Area of the circle: 12.57
Circumference of the circle: 12.57

I/O STATEMENTS, OPERATORS, EXPRESSIONS

EX.NO : 1(D) SIMPLE INTEREST AND COMPOUND INTEREST


DATE:

AIM :
To write program to find simple interest and compound interest.
ALGORITHM :
Simple Intersest
1. Step 1:Start.
2. Step 2:Read Principal Amount, Rate and Time.
3. Step 3:Calculate Interest using formula SI= ((amount*rate*time)/100)
4. Step 4:Print Simple Interest. AND Compound intersest
5. Step 5:Stop
Compound Interset
1. Step 1: Start
2. Step 2: Read 3 number for p, n, r
3. Step 3: Calculate C.I = p × (1 + r/100)n – p
4. Step 4: Print “The compound Interest = C.l”
5. Step 5: stop

PROGRAM
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
float p, t, r, si, ci;
clrscr();
printf("Enter principal amount (p): ");
scanf("%f", &p);
printf("Enter time in year (t): ");
scanf("%f", &t);
printf("Enter rate in percent (r): ");
scanf("%f", &r);
/* Calculating simple interest */
si = (p * t * r)/100.0;
/* Calculating compound interest */
ci = p * (pow(1+r/100, t) - 1);
printf("Simple Interest = %0.3f\n", si);
printf("Compound Interest = %0.3f", ci);
getch();
return(0);
}
Output:
Simple & Compound Interest
Enter principal amount (p): 5000 ↲
Enter time in year (t): 2 ↲
Enter rate in percent (r): 18 ↲
Simple Interest = 1800.000
Compound Interest = 1962.000

You might also like