URI Online Judge Solution 1073 Even Square - Solution in C, C++, Java, Python and C#
URI Online Judge Solution 1073 Even Square | BeginnerURI Problem Link - https://www.urionlinejudge.com.br/judge/en/problems/view/1073
Problem Name: 1073 Even Square
Problem Number : URI - 1073 Even Square
Online Judge : URI Online Judge Solution
Category: Beginner
Solution Language : C,C plus plus, java, python, c#(c sharp)
URI Solution 1073 Even Square Code in C:
#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;
}
URI Solution 1073 Even Square Code / URI 1002 solution in CPP:
#include <iostream>
using namespace std;
int main(int argc, const char * argv[])
{
int N, i;
cin >> N;
for(i = 1; i <= N; i++) {
if(i%2 == 0) {
cout << i << "^2 = " << i*i << endl;
}
}
return 0;
}
URI Solution 1073 Code / URI 1073 Even Square solution in Java:
/**
6
2^2 = 4
4^2 = 16
6^2 = 36
*/
import java.util.Scanner;
import java.io.IOException;
public class Main {
public static void main(String[] args) {
int N;
Scanner input =new Scanner(System.in);
N =input.nextInt();
for (int i = 2; i <= N; i+= 2) {
System.out.print(i+"^2 = "+(i*i)+"\n");
}
}
}
URI Solution 1073 Even Square Code / URI 1073 solution in Python:
a=int(input())
for n in range(1,(a+1)):
if (n%2==0):
print("%d^2 = %d" %(n, n**2))
URI Solution 1073Code / URI 1073 Even Square solution in C# (C Sharp):
Demonstration:
- Take a loop upto n
- Inside loop if that is divisble by 2 then
- square it and print it. Main Lines are this-
for ( i = 1; i <= n; ++i)
{
if(i % 2 == 0){
printf("%d^2 = %d\n", i,(i * i));
}
}
Tags: URI Online Judge Solution, URI OJ Solution list, URI Problems Solution, URI solver, URI all problem solution list, URI 1073 Even Square code in C, URI 1073 code in C++, URI 1073 Even Square solution in C, URI solution, URI 1073 Even Square solution in C,URI 1073 solution in C++-CPP,URI 1073 Even Square solution in C# (C sharp),URI 1073 Even Square solution in Java,URI 1073 solution in Python,
No comments:
Post a Comment