Bachelor of Technology in Information Technology


C program to calculate Volume of sphere



Download 0,65 Mb.
bet5/14
Sana20.03.2022
Hajmi0,65 Mb.
#502184
1   2   3   4   5   6   7   8   9   ...   14
Bog'liq
PSP Lab Manual

C program to calculate Volume of sphere


#include int main()
{
float r,vol=0; float pi=3.14;
printf("Enter the value for radius:"); scanf("%f",&r);
vol=(4*pi*r*r*r)/3;
printf("The volume of sphere is=%f\n",vol); return 0;
}
------------------------------*-----------OUTPUT----------------*------------------------


      1. C program to find Pythagoras Theorem


#include #include


int main()
{
//Pythagoras theorem float a,b,c;
printf("Enter the value for a and b\n"); scanf("%f%f",&a,&b);
c=sqrt(a*a+b*b);
printf("The final answer is:%f",c); return 0;
}
------------------------------*-----------OUTPUT----------------*------------------------




    1. Scientific problem solving using decision making and looping.




      1. Write a C program to find largest among three number




Algorithm:
Step 1: Start.
Step 2: declare num1, num2, num3 Step 3: print Enter three numbers Step 4: read num1, num2, num3.
Step 5: if(num1>num2 && num1>num3)
Print num1 is largest else if(num2>num3)
Print num2 is largest else Print num3 is largest
Step 6: if(num1Print num1 is smallest else if(num2Print num2 is smallest else Print num3 is smallest
Step 7: Stop.
Source Code #include #include int main()
{

int num1,num2,num3; //variable declaration printf("Enter three numbers\n");


scanf("%d %d %d",&num1,&num2,&num3);

//Takse three input num1, num2, num3 from user


//check largest


if(num1>num2 && num1>num3){


//check whether num1 is largest than num2 and num3 printf("%d is the largest number\n",num1);


}//if it is true this statement is displayed else if(num2>num3){
//when it is false then check num2 or num3 large printf("%d is the largest number\n",num2);
//when it is true this statements is displayed

}


else{

printf("%d is the largest number\n",num3);


}//all statements are false this statement is displayed


//check smallest


if(num1

//check whether num1 is smaller than num2 and num3 printf("%d is the smallest number\n",num1);


}//if it is truen this statement is displayed
else if(num2

//when it is false then check num2 or num 3 small


printf("%d is the smallest number\n",num2);//when it is true this statements is displayed


}

else{

printf("%d is the smallest number\n",num3);

}//all statements are false this statement is displayed getch();


return 0;

}
------------------------------*-----------OUTPUT----------------*------------------------





      1. Download 0,65 Mb.

        Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9   ...   14




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish