C Program to Calculate the Area of A Rectangle: (a) Using hard coded inputs (b) Using inputs supplied by the user.


Program code (a):

#include <stdio.h>  
int main()  
{  
    int width=5;  
    int height=10;  
    int area=width*height;  
    printf("Area of the rectangle=%d",area);  
}

Program code (b):

#include <stdio.h>
int main ()
{
int width,height,area;
printf("Enter width: ");
scanf("%d", &width);
printf("Enter Height: ");
scanf("%d",&Height);
area=width*Height;
printf("Area of the rectangle = %d",area);
}


To learn more about programming and coding visit our website. PDF study materials also available on our website.

Log on to: www.thecode11.com