URI Online Judge Solution | 1072 Interval 2 - 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

Friday, October 20, 2017

URI Online Judge Solution | 1072 Interval 2 - Solution in C, C++, Java, Python and C#

URI Online Judge Solution | 1072 Interval 2 - Solution in C, C++, Java, Python and C#

URI Online Judge Solution 1072 Interval 2 | Beginner
URI Problem Link - https://www.urionlinejudge.com.br/judge/en/problems/view/1072



Problem Name: 1072 Interval 2
Problem Number : URI - 1072 Interval 2
Online Judge : URI Online Judge Solution
Category: Beginner
Solution Language : C,C plus plus, java, python, c#(c sharp)



URI Solution 1072 Interval 2 Code in C / URI 1072 solution in C:


#include <stdio.h>
int main()
{
    int x, a, i;

    int in = 0;
    int out = 0;

    scanf("%d", &x);
    for(i = 0; i < x; i++)
    {
        scanf("%d", &a);
        if(a >= 10 && a <= 20){
            in++;
        }else{
            out++;
        }

    }
    printf("%d in\n", in);
    printf("%d out\n", out);

    return 0;
}

URI Solution 1072 Interval 2 Code / URI 1072 Interval 2 solution in CPP:


#include <iostream>

using namespace std;

int main(){
    int x, a;
    
    int in = 0;
    int out = 0;
    
    cin >> x;
    for(int i = 0; i < x; i++){
            cin >> a;
            if(a >= 10 && a <= 20) in++;
            else out++;
    }
    cout << in << " in\n";
    cout << out << " out\n";
    
    return 0;
}



URI Solution 1072 Interval 2 Code / URI 1072 Interval 2 solution in Java:


/**
4
    14
    123
    10
    -25
        2 in
        2 out
*/
import java.util.Scanner;

public class Main {

 public static void main(String[] args) {
  int N , X, in = 0, out = 0;
  int interval_start =10,interval_end =20 ;

  Scanner input =new Scanner(System.in);

  N =input.nextInt();
  for (int i = 1; i <= N; i++) {
   X =input.nextInt();
   if (X >= interval_start && X <= interval_end) {
    in += 1;
   }else {
    out += 1;
   }
  }
  System.out.print(in+" in\n"+out +" out\n");


 }

}


URI Solution 1072 Interval 2 Code / URI 1072 Interval 2 solution in  Python:


URI Solution 1072 Interval 2  Code / URI 1072 Interval 2 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 1072 Interval 2  code in C, URI 1072 Interval 2 code in C++, URI 1072 Interval 2  solution in C, URI solution, URI 1072 Interval 2 solution in C,URI 1072 Interval 2 solution in C++-CPP,URI 1072 Interval 2 solution in C# (C sharp),URI 1072 Interval 2 solution in Java,URI 1072 Interval 2 solution in Python,

No comments:

Post a Comment