URI Online Judge Solution 1066 Even, Odd, Positive and Negative – Solution in C, C++, Java, Python and C#
URI Online Judge Solution 1066 Even, Odd, Positive and Negative | Beginner
URI Problem Link – https://www.urionlinejudge.com.br/judge/en/problems/view/1066
Problem Name: 1066 Even, Odd, Positive and Negative
Problem Number : URI – 1066 Even, Odd, Positive and Negative
Online Judge : URI Online Judge Solution
Category: Beginner
Solution Language : C,C plus plus, java, python, c#(c sharp)
URI 1066 Even, Odd, Positive and Negative Code in C / URI 1066 solution in C:
#include <stdio.h>
int main()
{
int n, i;
int pos = 0, neg = 0, par = 0, im = 0;
for(i = 0; i < 5; ++i)
{
scanf("%d", &n);
if(n > 0){
pos++;
}else{
if(n != 0){
neg++;
}
}
if(n % 2 == 0){
par++;
}else{
im++;
}
}
printf("%d valor(es) par(es)n", par);
printf("%d valor(es) impar(es)n", im);
printf("%d valor(es) positivo(s)n", pos);
printf("%d valor(es) negativo(s)n", neg);
return 0;
}
Run URI 1066 code in C language with giving the inputs:
Input is:
Please copy ans paste this input in the input bar of jdoodle
Input Sample | Output Sample |
-5 0 -3 -4 12 |
3 valor(es) par(es) 2 valor(es) impar(es) 1 valor(es) positivo(s) 3 valor(es) negativo(s) |
Run:
URI 1066 Even, Odd, Positive and Negative Code in C++ / URI 1066 solution in CPP:
#include <iostream>
using namespace std;
int main()
{
int n;
int pos = 0, neg = 0, par = 0, im = 0;
for(int i = 0; i < 5; ++i)
{
cin >> n;
if(n > 0){
pos++;
}else{
if(n != 0){
neg++;
}
}
if(n % 2 == 0){
par++;
}else{
im++;
}
}
cout << par << " valor(es) par(es)" << endl;
cout << im << " valor(es) impar(es)" << endl;
cout << pos << " valor(es) positivo(s)" << endl;
cout << neg << " valor(es) negativo(s)" << endl;
return 0;
}
URI 1066 Even, Odd, Positive and Negative Code in java/ URI 1066 solution in Java:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int X, even = 0,odd = 0,positive = 0,negative = 0;
Scanner input =new Scanner(System.in);
for (int i = 1; i <= 5; i++) {
X = input.nextInt();
if (X % 2 == 0) {
even += 1;
}
if (X % 2 != 0) {
odd += 1;
}
if (X > 0) {
positive += 1;
}
if (X < 0) {
negative += 1;
}
}
System.out.print(even+" valor(es) par(es)n");
System.out.print(odd+" valor(es) impar(es)n");
System.out.print(positive+" valor(es) positivo(s)n");
System.out.print(negative+" valor(es) negativo(s)n");
}
}
Run URI 1065 code in Java language in a real time code editor:
URI 1066 Even, Odd, Positive and Negative Code in Python / URI 1066 solution in Python:
lista = []
i = 0
while i < 5:
numero = int(raw_input())
lista.append(numero)
i = i +1
i = 0
pares = 0
impares = 0
positivos = 0
negativos = 0
while(i < len(lista)):
if(lista[i] %2 == 0):
pares = pares + 1
elif(lista[i] %2 != 0):
impares = impares + 1
if(lista[i] > 0):
positivos = positivos + 1
elif(lista[i] < 0):
negativos = negativos + 1
i = i +1
print "%d valor(es) par(es)" %pares
print "%d valor(es) impar(es)" %impares
print "%d valor(es) positivo(s)" %positivos
print "%d valor(es) negativo(s)" %negativos
URI Solution 1066 Even, Odd, Positive and Negative Code / URI 1066 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 1066 Even, Odd, Positive and Negative code in C, URI 1066 Even, Odd, Positive and Negative code in C++, URI 1066 Even, Odd, Positive and Negative solution in C, URI solution, URI 1066 solution in C,URI 1066 solution in C++-CPP,URI 1066 Even, Odd, Positive and Negative solution in C# (C sharp),URI 1066 Even, Odd, Positive and Negative solution in Java,URI 1066 solution in Python,