0

it can b more simple or not I'm not getting

y= int(input("enter a num:\n")) print (y) if y==11: print("it is 10 or more than 10 ") elif y==0: print("but y is even 0") elif y==1: print("but y is odd 1") elif y==2: print("but y is even 2") elif y==3: print("but y is odd 3") elif y==4: print("but y is even 4") elif y==5: print("but y is odd 5") elif y==6: print("but y is even 6") elif y==7: print("but y is odd 7") elif y==8: print("but y is even 8") else y==9: print("y is odd 9")

23rd Nov 2016, 10:26 PM
Zameer shaikh
Zameer shaikh - avatar
4 Respuestas
+ 2
In my opinion you could check first if it's even or not and then print what it is and the y value separately, and maybe don't print the value at the beginning because you are printing it again later.
23rd Nov 2016, 10:33 PM
C.E.
C.E. - avatar
+ 2
y= int(input("enter a num: ")) s=y%2 if (s==0): print("the num is even") else: print("the num is odd") print(y)
23rd Nov 2016, 10:56 PM
Zameer shaikh
Zameer shaikh - avatar
+ 1
I'll try it😊
23rd Nov 2016, 10:44 PM
Zameer shaikh
Zameer shaikh - avatar
0
#include <iostream> using namespace std; int main() { int x; for( x=1;x<10;x++) cout <<"haris"<<endl; return 0; } I did like this I'm getting haris as output for 10 times🙎 I thought that this u were going to do!!!☺......
27th Nov 2016, 10:10 AM
Zameer shaikh
Zameer shaikh - avatar