URI / BEE CROWD 1098 - Sequence IJ 4 Solution in C,C++,Python | URI - BEECROWD - BEE 1098 Solution in C,C++,Python

URI / BEE CROWD 1098 - Sequence IJ 4 Solution in C,C++,Python | URI - BEECROWD - BEE 1098 Solution in C,C++,Python

                                                                                            beecrowd | 1098

Sequence IJ 4

Adapted by Neilor Tonin, URI  Brazil

                                                                                             Timelimit: 1


URI / BEE CROWD 1098 - Sequence IJ 4 Solution in C,C++,Python | URI - BEECROWD - BEE 1098 Solution in C,C++,Python:


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 SampleOutput Sample

I=0 J=1
I=0 J=2
I=0 J=3
I=0.2 J=1.2
I=0.2 J=2.2
I=0.2 J=3.2
.....
I=2 J=?
I=2 J=?
I=2 J=?

                                                          Demonstration:

This program does not take user inputs . Then check the conditions for each test case contains two integer number i and j .Then calculating the sequence by using conditional loop.

Finally print the result.

N.B: Don't copy paste the code as same. Just try to understand it and try yourself.

  URI / BEE 1098 Solution in C :   

  URI / BEECROWD Online Judge 1098 Solve  in C :                                          

#include <stdio.h>

int main(){
    float i = 0;
    float j = 1;
    
    while(i <= 2.2){
            if((i>0 && i<1)|| (i>1 && i<2) || (i>2.1 && i<=2.2) )
			{
			    printf("I=%0.1f J=%0.1f\n",i,j+i);
                            printf("I=%0.1f J=%0.1f\n",i,j+1+i);
                            printf("I=%0.1f J=%0.1f\n",i,j+2+i);
			}
			else
			{
			    printf("I=%d J=%d\n",(int)i,(int)j+(int)i);
                            printf("I=%d J=%d\n",(int)i,(int)j+1+(int)i);
                            printf("I=%d J=%d\n",(int)i,(int)j+2+(int)i);
			}
            
            i+= 0.2;
    }
    return 0;
}

0 Response to URI / BEE CROWD 1098 - Sequence IJ 4 Solution in C,C++,Python | URI - BEECROWD - BEE 1098 Solution in C,C++,Python

Post a Comment