Why this dont write any output?( basic C++ ) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why this dont write any output?( basic C++ )

Int n, m; // it is like a affirmation that n is mutiple of 5 m = n%5; If( m = 0){ cout << "yes " << endl; } return 0;

2nd Dec 2020, 4:06 AM
CODER FORCE
CODER FORCE - avatar
3 Answers
+ 11
//Run this code #include <iostream> using namespace std; int main() { // Why this dont write any output?( basic C++ ) int n,m; // it is like a affirmation that n is mutiple of 5 int m = n%5; if( m == 0){ cout << "yes " << endl; } return 0; } // output :- Yes //🙄and IDK ☹️ why coming error
2nd Dec 2020, 4:11 AM
ㅤㅤㅤ
+ 7
The code has too many errors that's why it isn't giving output . errors are not Int it's int . assign value to n . use if instead of If use == not =.
2nd Dec 2020, 4:11 AM
TOLUENE
TOLUENE - avatar
+ 6
Bcos variable n doesnt have any value assigned... Either u can ask from user through a cin stmt or Directly give some value like n=20; Also use == for comparison
2nd Dec 2020, 4:11 AM
Alphin K Sajan
Alphin K Sajan - avatar