Problem
Create a program that prints the following combination on the screen (console) using for loop.1 1
1 2
2 1
3 2
Solution - Code
#include<stdio.h>int main()
{
int i,j;
for(i=1;i<=3;i++)
{
for(j=1;j<=2;j++)
{
if(i==2 && j==2 || i==3 && j==1)
continue;
else
{
printf("%d%d\n",i,j);
}
}
}
system("pause");
return 0;
}
No comments :
Post a Comment
Note: Only a member of this blog may post a comment.