+ 2
Whats wrong with my code, and how do i make it work, help
#include <iostream> using namespace std; int main() { int a,b,n; int sum; cin>>a>>b; n=a/b; sum=b*n; if(a>b){ cout<<"A is bigger than B"<<endl; if(a>sum){ cout<<"A is bigger than B more than:"<<n<<"times!"; } } else { cout<<"B is bigger than A"; return 0; } }
2 Antworten
+ 3
Nvm, found a mistake, problem was in a>sum, should have been a>=sum lol
+ 2
You could leave the second If statement (if(a>sum)) away, cause it is not really useful, just write both cout parts in the same if statement!