how to print the elements placed in odd position | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how to print the elements placed in odd position

7th Aug 2016, 4:42 PM
hema
4 Answers
+ 1
int no=3; for(i=0;i<no;i++) { if(no%2) { cout<<"number is an even"<<no; } else { cout<<"number is an odd"<<no; } try it!!!!
7th Aug 2016, 5:30 PM
rahul lunagariya
rahul lunagariya - avatar
0
to print the number in odd position and not to print the number is even or odd. thanks
8th Aug 2016, 2:56 PM
hema
0
welcome
1st Sep 2016, 3:58 PM
rahul lunagariya
rahul lunagariya - avatar
0
when print the number in even position to change the if condition like if(no%2=0).. when print the number in odd position to change the if condition like if(no%2=1) try it....
1st Sep 2016, 4:02 PM
rahul lunagariya
rahul lunagariya - avatar