Algorithm
Problem Name: beecrowd | 1095
Problem Link: https://www.beecrowd.com.br/judge/en/problems/view/1095
Sequence IJ 1
Adapted by Neilor Tonin, URI Brazil
Make a program that prints the sequence like the following example.
Input
This problem doesn't have input.
Output
Print the sequence like the example below.
Input Sample | Output Sample |
I=1 J=60 |
Code Examples
#1 Code Example with C Programming
Code -
C Programming
#include<stdio.h>
int main()
{
int i,j;
for(i=1,j=60;i < 15,j>=0;i+=3,j-=5){
printf("I=%d J=%d\n",i,j);
}
}
Copy The Code &
Try With Live Editor
Output
I=1 J=60
I=4 J=55
I=7 J=50
...
I=? J=0
#2 Code Example with C++ Programming
Code -
C++ Programming
#include <iostream>
using namespace std;
int main(){
int i = 1;
for(int j = 60; j >= 0; j--){
cout << "I=" << i << " " << "J=" << j << "\n";
i += 3;
j -= 4;
}
return 0;
}
Copy The Code &
Try With Live Editor
Output
I=1 J=60
I=4 J=55
I=7 J=50
...
I=? J=0
#3 Code Example with Python Programming
Code -
Python Programming
i = 1
j = 60
while j >= 0:
print(f'I={i} J={j}')
i = i + 3
j = j - 5
Copy The Code &
Try With Live Editor
Output
I=1 J=60
I=4 J=55
I=7 J=50
...
I=? J=0