santhanasamy


{ City } tamilnadu
< Country > india
* Profession * programmer
User No # 40441
Total Questions Posted # 0
Total Answers Posted # 1

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 63
Users Marked my Answers as Wrong # 9
Questions / { santhanasamy }
Questions Answers Category Views Company eMail




Answers / { santhanasamy }

Question { Infosys, 41581 }

how to print
1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2 1
using any loop(for or while) only once(only 1 loop) and
maximum 2 variables using C.


Answer

int i = 1,j=1;
do
{
printf("%d",i);
if (j<10)
i++;
else
i--;
j++;
}while(j<20);

Is This Answer Correct ?    63 Yes 9 No