Code:
#include <stdio.h>#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(void) {
int secim;
/*cylinder,cube, square pyramid, cone, sphere*/
printf("1.Silindir\n2.Küp\n3.Kare Piramit\n4.Koni\n5.Kure\n");
/*please enter the number of the prism*/
printf("\nHacmi hesaplanacak prizmanin numarasini giriniz");
scanf("%d",&secim);
if(secim==1);
/*volue*/
{ float pi=22/7.0,r,h,hacim;
/*enter the height and radius.*/
printf("\nLutfen hacmi hesaplanacak silindirin yaricapi ve yükseligini giriniz");
scanf("%d %d",&r,&h);
hacim=pi*r*r*h;
/*the volume of the cylinder.*/
printf("\nSilindirin hacmi %8.6f'dir.\n",hacim);
}
(secim==2);
{ float pi=22/7.0,a,hacim;
/*enter the length of the edge.*/
printf("\nLutfen hacmi hesaplanacak kupun kenar uzunlugunu giriniz");
scanf("%d",&a);
hacim=a*a*a;
/*the volume of the cube.*/
printf("\nKupun hacmi %8.5f'dir.\n",hacim);
}
if(secim==3);
{ float a,h,hacim;
/*enter the length of the edge.*/
printf("\nLutfen hacmi hesaplanacak kare piramidin kenar uzunlugunu ve yüksekligini giriniz");
scanf("%d %d",&a,&h);
hacim=a*a*h/3;
/*the volume of the cylinder.*/
printf("\nSilindirin hacmi %8.4f'dir.\n",hacim);
}
if(secim==4);
{
float r,h,pi=22/7.0,hacim;
/*enter the height and radius.*/
printf("\nLutfen hacmi hesaplanacak koninin yarıicapi ve yüksekligini giriniz");
scanf("%d %d",&r,&h);
hacim=pi*r*r*h/3;
/*the volume of the cone.*/
printf("\nKoninin hacmi %8.3f'dir.");
}
if(secim==5);
{
float pi=22/7.0,r,hacim;
/*enter the radius*/
printf("\nLutfen hacmi hesaplanacak kurenin yaricapini giriniz");
scanf("%d",&r);
hacim=4/3*pi*r*r*r;
/*the volume of the sphere.*/
printf("\nKurenin hacmi %8.2f'dir.");
}
return 0;
}
I've done it.but I have a problem.I don't get the error when compiling the program.but the result is always 0.my language is Turkish.I hope you understand.