Topic:
If Statement
Problem:
Write a program that inputs two numbers and finds whether both are equal.
Solution:
#include<iostream.h>
#include<conio.h>
int main ()
{
cout<<endl<<endl<<endl;
int a,b;
cout<<"enter two numbers";
cin>>a>>b;
if(a==b)
cout<<endl<<"both numbers are equal";
getch();
}
#include<conio.h>
int main ()
{
cout<<endl<<endl<<endl;
int a,b;
cout<<"enter two numbers";
cin>>a>>b;
if(a==b)
cout<<endl<<"both numbers are equal";
getch();
}
Output:
Let me know in the comment section if you have any question.
Previous Post:
Program to calculate area and perimeter of a triangle.