URI Online Judge Solution 1073 Even Square - Solution in C, C++, Java, Python and C# - Online Judge Solution

Latest

It is a free Online judges problems solution list. Here you can find UVA online Judge Solution, URI Online Judge Solution, Code Marshal Online Judge Solution, Spoz Online Judge Problems Solution

Saturday, October 28, 2017

URI Online Judge Solution 1073 Even Square - Solution in C, C++, Java, Python and C#

URI Online Judge Solution 1073 Even Square - Solution in C, C++, Java, Python and C#

URI Online Judge Solution 1073 Even Square | Beginner
URI 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)

1073 Even Square


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:

  1. Take a loop upto n
  2. Inside loop if that is divisble by 2 then
  3. 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));
  }
 }



Just implement this in coding. Since having any problem just put a comment below. Thanks



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