1144 Logical Sequence

SemiColon
By -
0
URI Online Judge | 1144

Logical Sequence

Write a program that reads an integer N. N * 2 lines must be printed by this program according to the example below. For numbers with more than 6 digits, all digits must be printed (no cientific notation allowed).

Input

The input file contains an integer N (1 < N < 1000).

Output

Print the output according to the given example.
Input SampleOutput Sample
51 1 1
1 2 2
2 4 8
2 5 9
3 9 27
3 10 28
4 16 64
4 17 65
5 25 125
5 26 126



Solution:

#include <stdio.h>
int main()
{
    int a,b,c,d,e,f;
    scanf("%d", &a);
    for(b=1; b<=a; b++)
    {
        c=b*b;
        d=b*b*b;
        printf("%d %d %d\n",b,c,d);
        e=c+1;
        f=d+1;
        printf("%d %d %d\n",b,e,f);
    }
    return 0;
}


Tags:

Post a Comment

0Comments

Post a Comment (0)