write a program to check whether the given number is greater than 45 or not.
this is based on the conditional statements. please tell the answer.
Answers
Answer:
In 4 programming languages :
QBASIC:-
INPUT"Enter a number: "; A
IF A>45
PRINT " It is greater than 45"
ELSE
PRINT " it is not greater than 45"
END IF
END
Python:-
x=int(input("Enter a number: "))
if x>45:
print(" It is greater than 45")
else
print(" It is not greater than 45")
Java:-
import java.util.*;
public class Homework {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
System.out.print("Input a number: ");
int n = in.nextInt();
if (n>45) {
System.out.println(" It is greater than 45");
}
else {
System.out.println("It is not greater than 45");
}
}
}
C++:-
#include<iostream>
using namespace std;
int main()
{
int number, remainder;
cout << "Enter the number : ";
cin >> number;
if (number>45)
cout << number << " is greater than 45 " << endl;
else
cout << number << " is not greater than 45 " << endl;
return 0;
}