URI Online Judge Solution 1065 Even Between five Numbers - Solution in C, C++, Java, Python and C#
URI Online Judge Solution 1065 Even Between five Numbers | Beginner
URI Problem Link - https://www.urionlinejudge.com.br/judge/en/problems/view/1065
Problem Name: 1065 Even Between five Numbers
Problem Number : URI - 1065 Even Between five Numbers
Online Judge : URI Online Judge Solution
Category: Beginner
Solution Language : C,C plus plus, java, python, c#(c sharp)
URI 1065 Even Between five Numbers Code in C / URI 1065 solution in C:
#include <stdio.h> int main() { int a, i; int tmp = 0; for (i = 0; i < 5; ++i) { scanf("%d", &a); if(a < 0){ a = -a; } if(a % 2 == 0){ tmp++; } } printf("%d valores pares\n", tmp); return 0; }
Run URI 1065 code in Compiler with the input:
Input:
Input Sample | Output Sample |
7 -5 6 -4 12 | 3 valores pares |
Run:
URI 1065 Even Between five Numbers Code in C++ / URI 1065 solution in CPP:
#include <cstdio> int main() { int a; int tmp = 0; for (int i = 0; i < 5; ++i) { scanf("%i", &a); if(a < 0){ a = -a; } if(a % 2 == 0){ tmp++; } } printf("%i valores pares\n", tmp); return 0; }
URI 1065 Even Between five Numbers Code in java/ URI 1065 solution in Java:
import java.util.*; public class Main { public static void main(String args[]) { int a, i; int tmp = 0; Scanner input = new Scanner(System.in); for (i = 0; i < 5; ++i) { a = input.nextInt(); if(a < 0){ a = -a; } if(a % 2 == 0){ tmp++; } } System.out.printf("%d valores pares\n", tmp); } }
Run URI 1065 code in Java with giving the predefined input:
URI 1065 Even Between five Numbers Code in Python / URI 1065 solution in Python:
n1 = int(raw_input()) n2 = int(raw_input()) n3 = int(raw_input()) n4 = int(raw_input()) n5 = int(raw_input()) lista =[n1,n2,n3,n4,n5] i = 0 pares = 0 while(i < len(lista)): if(lista[i] %2 == 0): pares = pares + 1 i = i +1 print "%d valores pares" %pares
URI Solution 1065 Even Between five Numbers Code / URI 1065 solution in C# (C Sharp):
Demonstration:
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 1065 Even Between five Numbers code in C, URI 1065 code in C++, URI 1065 Even Between five Numbers solution in C, URI solution, URI 1065 Even Between five Numbers solution in C,URI 1065 solution in C++-CPP,URI 1065 solution in C# (C sharp),URI 1065 Even Between five Numbers solution in Java,URI 1065 solution in Python,
No comments:
Post a Comment