Program to find parameter and area of circle according to choice in c language.

#include<stdio.h>
#include<conio.h>
void main()
{
    int choice;
    float r,area,per;
    clrscr();
    printf("press 1 for area.\n");
    printf("press 2 for parameter.\n");
    printf("enter the radius of circle=");
    scanf("%f",&r);
    printf("\nenter your choice=");
    scanf("%d",&choice);
    switch(choice)
    {
    case 1:
              area=3.14*r*r;
              printf("the area of circle is =%f",area);
              break;
    case 2:
              per=2*3.14*r;
              printf("the parameter of circle is=%f",per);       
              break;    
    default:
              printf("wrong choice.");         
    }
    getch();
}

■》 Output->
Press 1 for area.
press 2 for parameter.
enter the radius of circle=10

enter your choice=2
 
the parameter of circle is=62.799999

Comments

Popular posts from this blog

Introduction of java Programming language.

Stack data structure.