Algorithm
Sequence IJ 2
Adapted by Neilor Tonin, URI Brazil
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 |
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
#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
#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