Input
The input file contains an integer N (1 < N < 1000).
Output
Print the output according to the given example.
Input Sample | Output Sample |
5
|
1 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 using C :
#include <stdio.h>
int main() {
int n,i,j;
scanf("%d",&n);
for(i=1; i<=n; i++)
{
for(j=1; j<=2; j++)
{
if(j==1)
printf("%d %d %d\n",i,i*i, i*i*i);
else
printf("%d %d %d\n",i,(i*i)+1, (i*i*i)+1);
}
}
return 0;
}
Comments
Post a Comment