C program to calculate area and perimeter of Circle.

Question:

Write a C program to take a radius from user and calculate the area and perimeter of circle.

Source code:

#include<stdio.h> void main() { int rad; float perimeter,area; printf("Enter radius :"); scanf("%d",&rad); perimeter=2*3.14*rad; area=3.14*rad*rad; printf("Perimeter:%f \n",perimeter); printf("Area:%f",area); }

Output:

Enter radius :4 Perimeter:25.120001 Area:50.240002

Comments

Popular posts from this blog

Introduction to Python.

Decision Making Statement.