+ 1

How to create a program which will prompt the user to enter a number less than 100 and output the message: Welcome obedient

24th Mar 2017, 9:42 AM
Jewald
5 Antworten
+ 9
@yann it should be "< 100" not ">100"
24th Mar 2017, 11:04 AM
Agus Mei
Agus Mei - avatar
+ 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"; } }
24th Mar 2017, 10:05 AM
देवेंद्र महाजन (Devender)
देवेंद्र महाजन (Devender) - avatar
+ 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"); } }
24th Mar 2017, 10:55 AM
Yannick Rogandji
Yannick Rogandji - avatar
+ 1
you right @Agus. it's fixed, thanks
24th Mar 2017, 12:09 PM
Yannick Rogandji
Yannick Rogandji - avatar
0
In python: print ("Please enter a number less than 100") number = int(input()) if number < 100: print ("Welcome obedient")
24th Mar 2017, 10:05 AM
merkrafter