1073 Even Square

SemiColon
By -
0
URI Online Judge | 1073

Even Square

Read an integer N. Print the square of each one of the even values from 1 to including if it is the case.

Input

The input contains an integer (5 < < 2000).

Output

Print the square of each one of the even values from 1 to N, as the given example.
Be carefull! Some language automaticly print 1e+006 instead 1000000. Please configure your program to print the correct format setting the output precision.
Input SampleOutput Sample
62^2 = 4
4^2 = 16
6^2 = 36
 


 Solution:

#include <stdio.h>
int main()
{
 int n, i;

 scanf("%d", &n);

 for ( i = 1; i <= n; ++i)
 {
  if(i % 2 == 0){
   printf("%d^2 = %d\n", i,(i * i));
  }
 }

 return 0;
}

Tags:

Post a Comment

0Comments

Post a Comment (0)