Practical Assignment 1
Practical Assignment 1
IT 245148
• Input : -
#include <stdio.h>
# include <math.h>
int main(){
float n1, n2, div;
div = n1/n2;
• Output :-
• Input :-
1
Vansh Shah Msc.IT 245148
#include <stdio.h>
#include <math.h>
int main(){
float K,M,F=1.60934;
K=M*F;
• Output :-
Volume of a Cylinder
Formula: V=π×r^2×h
• Input :-
#include <stdio.h>
#include <math.h>
int main(){
float V,pi=3.14,r,h;
2
Vansh Shah Msc.IT 245148
V=pi*r*r*h;
• Output :-
• Input :-
#include <stdio.h>
#include <math.h>
int main(){
float BMI, W, H;
BMI = W/H*H;
3
Vansh Shah Msc.IT 245148
• Output :-
• Input :-
int main(){
int n1,n2;
if(n1!=n2){
printf("\n %d and %d Are Not Equal", n1,n2);
}
else{
printf("\n %d and %d Are Equal", n1,n2);
}
return 0;
}
4
Vansh Shah Msc.IT 245148
• Output :-
• Input :-
int main(){
int n1;
if(n1<0){
printf("\n The No. Is Less Than 0 Or Negative");
}
else{
printf("\n The No. Is Greater Than 0 Or Positive");
}
}
5
Vansh Shah Msc.IT 245148
• Output :-
• Input:-
#include <stdio.h>
#include <conio.h>
int main(){
int age,sal,cs;
6
Vansh Shah Msc.IT 245148
• Output :-
• Input:-
#include <stdio.h>
int main() {
7
Vansh Shah Msc.IT 245148
printf("Do you agree to a 1-year contract? (1 for Yes, 0 for No): ");
scanf("%d", &ca);
8
Vansh Shah Msc.IT 245148
return 0;
}
• Output :-
Print Series
Series: w, w^2, w^3, w^4,
• Input :-
#include <stdio.h>
#include <math.h>
int main() {
int w;
printf("ENTER A NUMBER : ");
scanf("%d", &w);
printf("Series: ");
for (int i = 1; i <= ; i++)
{
printf("%f", (pow(w, i)+i));
}
printf("\n");
9
Vansh Shah Msc.IT 245148
• Output:-
ENTER A NUMBER : 5
Series: 6.000000 27.000000 128.000000 629.000000 3130.000000
Print Series
Series: w^1 + 1^1, w^2 + 2^2, w^3 + 3^3,
• Input :-
#include <stdio.h>
#include <math.h>
int main() {
int w, n;
printf("Series: ");
for (int i = 1; i <= n; i++) {
int term = (int)pow(w, i) + (int)pow(i, i);
printf("%d ", term);
}
printf("\n");
return 0;
}
• Output:-
10
Vansh Shah Msc.IT 245148
11