Welcome

>>>Welcome to my "CODE BAZAR"
Code marshal
URI online judge
Others
Code marshal
URI online judge
Others
Code marshal
URI online judge
Others

Update ✔✔✔ Upcoming programming book (.pdf) "Programming Contest (data structures and algorithms) by Md. Mahbub Hasan & "Graph Algorithms" by Safayat Asraf "****** Date: 20 March, 2019****Hazrat Ali****

Monday, 14 November 2016

URI-1073

URI Online Judge | 1073

Even Square

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
Problem link Click here
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 a,i,sum=0;
    scanf("%d",&a);
    for(i=2;i<=a;i=i+2){
        sum=i*i;
        printf("%d^2 = %d\n",i,sum);
    }
    return 0;
}

No comments:

Post a Comment