URI Online Judge | 1097
Sequence IJ 3
Adapted by Neilor Tonin, URI
Brazil
Timelimit: 1
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 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 |
URI Online Judge Solution 1097 || Sequence IJ 3 in JAVA
import java.io.IOException;public class Main { public static void main(String[] args) throws IOException { for (int i = 1,j =7; i <= 9; i += 2,j += 2) { for (int l = i, k = j; k >= (j-2); k--) { System.out.print("I="+l+" J="+k+"\n"); } } }}URI Online Judge Solution 1097 || Sequence IJ 3 in C
#include<stdio.h>
int main(){
int i, I, j, k;
for (int i = 1,j =7; i <= 9; i += 2,j += 2) {
for (int l = i, k = j; k >= (j-2); k--) {
printf("I=%d J=%d\n", I, k);
}
}
return 0;
}
Dropbox download link
Question link URI
No comments:
Write commentsTo know more about the problem, give us your valuable commment. We'll try to help you. Thanks