Topic:
If Statement
Problem:
Write a program that inputs two numbers and finds if second number is square of first.
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*a==b)
cout<<endl<<"second number"<<b<<"is square of first number."<<a;
getch();
}
#include<conio.h>
int main ()
{
cout<<endl<<endl<<endl;
int a,b;
cout<<"enter two numbers";
cin>>a>>b;
if(a*a==b)
cout<<endl<<"second number"<<b<<"is square of first number."<<a;
getch();
}
Output:
Let me know in the comment section if you have any question.
Previous Post:
Program that inputs two numbers and finds whether both are equal.