Group - 3 - Practical 3
Group - 3 - Practical 3
Group - 3 - Practical 3
Output:
Square of the number 6 is 36
Cube of the number 6 is 216
Q3) Write program in C to accept any 3 numbers from
user & calculate their average.
Input:
#include <stdio.h>
#include<conio.h>
void main()
{
int n1,n2,n3;
float avg;
printf("\nEnter Three Numbers:");
scanf("%d %d %d",&n1,&n2,&n3);
avg=(n1+n2+n3)/3;
printf("\nAverage: %0.2f",avg);
getch();
}
Output:
Enter Three Numbers:30
40
50
Average:40.00
Q4) Write program in C to accept principal amount ,
No of years , Rate of interest from user &
calculate Simple Interest.
Input
Input:-
#include<stdio.h>
int main()
{
float P,R,T,SI;
P=34000;
R=30;
T=5;
SI=(P*R*T)/100;
printf("\n\n Simple Interest os:%f",SI);
return(0);
}
Output:
Output:
Enter Radius Of Circle:2
Area Of Circle= 12.56
Perimeter Of Circle= 12.56
Q6)
Input:
#include<conio.h>
#include<stdio.h>
void main()
{
int a, b, temp;
printf("\n\t Enter a : ");
scanf("%d", &a);
printf("\n\t Enter b : ");
scanf("%d", &b);
printf("\n\n\t Before Swap : a = %d \t b = %d", a,
b);
temp = a;
a = b;
b = temp;
printf("\n\n\n\t After Swap : a = %d \t b = %d", a,
b);
getch();
}
Output:
Enter a : 34
Enter b : 35
Before Swap : a = 34 b = 35
After Swap : a = 35 b = 34
return 0;
}
Output:-
Enter marks of five subjects:
90
87
76
73
82
Total marks = 408.00
Percentage = 81.60