-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask1.cpp
More file actions
26 lines (21 loc) · 698 Bytes
/
task1.cpp
File metadata and controls
26 lines (21 loc) · 698 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// TASK 1
// NUMBER GUESSING GAME
// jai shree ram
/* statement-->"Create a program that generates a random number and asks the
user to guess it. Provide feedback on whether the guess is too
high or too low until the user guesses the correct number."*/
#include <iostream>
using namespace std;
int main()
{
int random = 418;
int guess;
cout << "guesse the random number--> ";
cin >> guess;
if (guess < random)
cout << "too low! until the user guesses the correct number! try again";
else if (guess > random)
cout << "too high! until the user guesses the correct number! try again";
else
cout << "congratulation! guesse the correct number";
}