Q: program to print 1,10,2,9,3,8,4,7,5,6.....
#include
#include
void main()
{
int i=1,c,j=10;
clrscr();
for(c=1;c<=10;c++)
{
if(c%2==1)
{
printf("%d ",i);
i++;
}
else
{
printf("%d ",j);
j--;
}
}
getch();
}
No comments:
Post a Comment