0
how to print the elements placed in odd position
4 odpowiedzi
+ 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!!!!
0
to print the number in odd position and not to print the number is even or odd.
thanks
0
welcome
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....