Home C Language Basic C Programs const in C

const in C

Write a C Program to demonstrate “const” keyword.

#include <stdio.h>

#define NEWLINE ‘\n’

int main()


   const float Pi=3.14;

   float radius, area;

   printf(“Enter radius of a circle: ”);

   scanf(“%f”, &radius)

   area = Pi*radius*radius;

   printf(“Area of the circle is: %2f %c”, area,NEWLINE);

   return 0;



Enter radius of a circle: 5.2

Area of the circle is: 84.95