/*
* 1000+ C programs + tutorials
*
*
* 5_calculate_area_of_square.c
*
* Created on: Oct 20, 2014
* Author: Code2care.org
*/
#include <stdio.h>
//#include <conio.h>
void main() {
int side;
int area;
// clrscr();
printf("Program to calculate Area of a Square : \n\n");
printf("Enter the side of a square : ");
scanf("%d", &side);
area = side*side;
printf("\n\nArea of square with side %d = %ld \n\n",side,area);
// getch();
}
-
Output :
Program to calculate Area of a Square :
Enter the side of a square : 20
Area of square with side 20 = 400
Without using the variable
area
/*
* 1000+ C programs + tutorials
*
*
* 5_calculate_area_of_square.c
*
* Created on: Oct 20, 2014
* Author: Code2care.org
*/
#include <stdio.h>
//#include <conio.h>
void main() {
int side;
// clrscr();
printf("Program to calculate Area of a Square : \n\n");
printf("Enter the side of a square : ");
scanf("%d", &side);
printf("\n\nArea of square with side %d = %ld \n\n",side,side*side);
// getch();
}
-
Output :
Program to calculate Area of a Square :
Enter the side of a square : 30
Area of square with side 30 = 900
The best way to learn C programming is to practice more and more of programs .
Code2care C Programming tutorials provide 1000+ programs in C that you can study and become an expert in the language. Programs are divided into categories depending upon type and complexity.
BSc. IT, BSc. Computer Science, BSc. IT, MSc. IT, MSc. Computer Science, MCA, BTech IT & BTech Engineers may find these programs very useful.