C Program to find area of Circle (Use Constant)

Description

Get radius of circle and find area of circle.
Sample Input 1:
4
Sample Output 1:
50.24

Solution

#include<stdio.h>

int main()

{
    
	const float pi=3.14;
	int radius;
	float area;
	printf("Enter Radius:");
    
	scanf("%d",&radius);

	area=pi * (radius * radius);
    
	printf("Area of Circle: %.2f",area);
    
	return 0;

}

Explanation

Get radius of a circle (using scanf statement)

Calculate area by  multiplying pi and radius and radius (area =pi*radius*radius)
 (pi is  3.14 , global constant)

print area (using printf statement)



Interesting Pattern Programs: for more Patterns

Input:
5
Output:
*
**
***
****
*****
****
***
**
*Solution
Input:
5
Output:
    *
   ***
  *****
 *******
*********
 *******
  *****
   ***
    *Solution
Input:
5
Output:
*        *
**      **
***    ***
****  ****
**********Solution
Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********Solution
Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********
**** ****
***   ***
**     **
*       *Solution
Input:
5
Output:
*********
 *******
  *****
   ***
    *
   ***
  *****
 *******
*********Solution