C program to calculate perimeter and area of a rectangle
In this program, we declare variables for the length, breadth, perimeter, and area of the rectangle. We prompt the user to enter the length and … Read more
In this program, we declare variables for the length, breadth, perimeter, and area of the rectangle. We prompt the user to enter the length and … Read more
C program to calculate perimeter and area of a square. Take sides of square as input. Sol. // C program to calculate perimeter and area of a square #include <stdio.h> int main(){ float sideOfSquare, areaOfSquare, perimeterOfSquare; printf(“Enter length of side of squaren”); scanf(“%f”, &sideOfSquare); // Perimeter of Square = 4*Side perimeterOfSquare = 4*sideOfSquare; … Read more
C Program to calculate perimeter and area of a circle, take radius as input. Sol. //C program to find area and perimeter of a circle #include<stdio.h> int main() { //In circle pi = 3.14 float radius, perimeter, area, pi=3.14; printf(“nEnter the radius of Circle : “); scanf(“%f”, &radius); // Perimeter of circle = 2πr perimeter = 2 * pi * radius; … Read more
C Program to calculate sum, difference, product, division and remainder of two numbers ? Sol. #include <stdio.h> int main() { int num1, num2, sum, difference, product, remainder ; float division; printf( “Please enter two numbers: “); scanf(“%d %d”, & num1, & num2); sum = num1 + num2; difference = num1 – num2; product = num1 * num2; … Read more