URI Online Judge Solution 1097 Sequence IJ 3 using C Programming Language.
Make a program that prints the sequence like the following exemple.
Input
This problem doesn't have input.
Output
Print the sequence like the example below.
Input Sample | Output Sample |
I=1 J=7
I=1 J=6 I=1 J=5 I=3 J=9 I=3 J=8 I=3 J=7 ... I=9 J=15 I=9 J=14 I=9 J=13 |
Solution using C :
#include <stdio.h>
int main() {
int i,j,p=7,q=5;
for(i=1; i<=9; i+=2)
{
for(j=p; j>=q; j--)
{
printf("I=%d J=%d\n",i,j);
}
p+=2;
q+=2;
}
return 0;
}
Comments
Post a Comment