for(int i = 10 ; b >= i;i++){
if(i%2 == 0)
cout << "even" << endl;
else
cout << "odd" << endl;
}
for(int i = 10 ; b >= i;i++){
if(i%2 == 0){
cout << "even" << endl;
}else{
cout << "odd" << endl;
}
}
both of these code work with the only difference being the curly brackets for if else statement, just wondering when to use curly brackets and when not to?
Aucun commentaire:
Enregistrer un commentaire