Anyone know how to set ranges in variables | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Anyone know how to set ranges in variables

This is what I am trying to do. I guess by looking at the code you get the idea. #include <iostream> using namespace std; int main() { int mark = 64; if (mark < 65) { cout << "You failed." << endl; cout << "Sorry" << endl; } else { cout << "Congratulations!" << endl; cout << "You passed." << endl; cout << "You are awesome!" << endl; } if (60 - 65) { cout << "below a d"; } if (70 - 79) { cout << "you have a c"; } return 0; }

22nd Jun 2018, 5:43 AM
Quadier Mackey
Quadier Mackey - avatar
2 Answers
+ 1
use this if(mark>=60 & & mark<=65) and same idea for others
22nd Jun 2018, 5:55 AM
Abhishek Rawat
Abhishek Rawat - avatar
0
thanks!
22nd Jun 2018, 5:57 AM
Quadier Mackey
Quadier Mackey - avatar