+ 1
How to create a program which will prompt the user to enter a number less than 100 and output the message: Welcome obedient
5 Answers
+ 9
@yann
it should be "< 100" not ">100"
+ 2
#include <iostream>
using namespace std;
int main (){
int x;
cout<<"Enter any number less than 100: ";
cin>>x;
if (x<100){
cout<<"Welcome Obedient";
}else{
cout<<"Invalid value";
}
}
+ 1
I don't know which langage you're using but in javascript you can easily do it that way:
var lessNumber = prompt("enter a number");
if ( lessNumber < 100 )
{
alert ("Welcom obedient ");
}
else
{
alert ("We need you to chose a number less than 100");
}
}
+ 1
you right @Agus. it's fixed, thanks
0
In python:
print ("Please enter a number less than 100")
number = int(input())
if number < 100:
print ("Welcome obedient")