Algorithm


Problem Name: beecrowd | 1096
Problem Link: https://www.beecrowd.com.br/judge/en/problems/view/1096

Sequence IJ 2

Adapted by Neilor Tonin, URI Brazil

Timelimit: 1

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=7
I=3 J=6
I=3 J=5
...
I=9 J=7
I=9 J=6
I=9 J=5

 

Code Examples

#1 Code Example with C Programming

Code - C Programming


#include <stdio.h>

int main()
{
    int I,J;
    for(I=1;I < =9;I=I+2)
    {
        for(J=7;J>=5;J--)
            printf ("I=%d J=%d\n",I,J);
    }
    return 0;
}
Copy The Code & Try With Live Editor

Output

x
+
cmd
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

#2 Code Example with C++ Programming

Code - C++ Programming


#include <iostream>

using namespace std;

int main(){
    
    for(int i = 1; i  <  10; i+=2){
            for(int j = 7; j > 4; j--){
                    cout << "I=" << i << " " << "J=" << j << "\n";
            }
    }
    return 0;
}
Copy The Code & Try With Live Editor

Output

x
+
cmd
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

#3 Code Example with Python Programming

Code - Python Programming


for i in range(1,10,2):
    for j in range(7,4,-1):
        print(f"I={i} J={j}")
Copy The Code & Try With Live Editor

Output

x
+
cmd
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
Advertisements

Demonstration


Previous
#1095 Beecrowd Online Judge Solution 1095 Sequence IJ 1 - Solution in C, C++, Java, Python and C#
Next
#1097 Beecrowd Online Judge Solution 1097 Sequence IJ 3 - Solution in C, C++, Java, Python and C#