0

What's Mistakes in this code....?? 🤔

#include <iostream> using namespace std; int main() { int O; int P; cout <<"Enter Your Obtained Marks: "; cin >> O; P = (O/1100)*100; if(P>=33) cout <<"Your are PaSS"; else cout <<"Your are Fail"; return 0; }

21st Sep 2019, 6:31 PM
ShahzadTabassum
ShahzadTabassum - avatar
3 Respostas
+ 4
Division between two integers result in an integer. You should do P = (float) O / 1100 * 100; instead. Also there are grammar mistakes.
21st Sep 2019, 6:35 PM
Airree
Airree - avatar
+ 2
There doesn't appear to be a technical mistake in the code. What is supposed to happen/ What is the program supposed to do? Maybe provide some sample input and output.
21st Sep 2019, 6:36 PM
Shadow
Shadow - avatar
0
Just to add to Airree's answer: declare P as float.
21st Sep 2019, 8:19 PM
Ulisses Cruz
Ulisses Cruz - avatar