[URI Online Judge] – 1096 – Sequence IJ 2

Make a program that prints the sequence like the following exemple.

Input

This problem has no input.

Output

Print the sequence like example below.

Sample Input Sample Output
I=1 J=7
I=1 J=6
I=1 J=5
I=3 J=7
I=3 J=6
I=3 J=5

I=9 J=7
I=9 J=6
I=9 J=5

Solution:

#include <cstdio>
int main(){
 for (int i = 1; i <= 9; i += 2){
 printf("I=%d J=7\n", i);
 printf("I=%d J=6\n", i);
 printf("I=%d J=5\n", i);
 }
 return 0;
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s