Write a program to input length and width of a shape and find shape is square or rectangle.
About Program
In this program we input length and width of a shape and check what kind of shape.
To understand this program you should knowledge of some basic conditional statements (if-else) program. Some Basic conditional statements programs are below.
If length and width of shape is same then we print Square else print Rectangle.
#include<stdio.h>
#include<conio.h>
void main()
{
int l,w;
clrscr();
printf("Enter length and width of shape=");
scanf("%d%d",&l,&w);
if(l==w)
printf("\nShape is Square");
else
printf("\nShape is Rectangle");
getch();
}
OUTPUT
Enter length and width of shape=5
5
Shape is Square
OR
Enter length and width of shape=5
6
Shape is Rectangle
Related Examples
In this program we input length and width of a shape and check what kind of shape.
To understand this program you should knowledge of some basic conditional statements (if-else) program. Some Basic conditional statements programs are below.
If length and width of shape is same then we print Square else print Rectangle.
#include<stdio.h>
#include<conio.h>
void main()
{
int l,w;
clrscr();
printf("Enter length and width of shape=");
scanf("%d%d",&l,&w);
if(l==w)
printf("\nShape is Square");
else
printf("\nShape is Rectangle");
getch();
}
OUTPUT
Enter length and width of shape=5
5
Shape is Square
OR
Enter length and width of shape=5
6
Shape is Rectangle
Related Examples
- Write a program to input sell price and cost price and find transaction is profit or loss.
- Write a program to input a number and check number is odd or even.
- Write a program to input two number and find smallest number.
- Write a program to input two number and find highest number.
Share and Comment.
Follow for recently updates.
Comments
Post a Comment