Algorithm


URI Online judge 1001 Problem Link: https://www.urionlinejudge.com.br/judge/en/problems/view/1001

Simple Algorithm - 

  1. Take Two input
  2. Make sum = input 1 + input 2
  3. Print Result

 

Code Examples

#1 Code Example with C Programming

Code - C Programming

#include <stdio.h>
int main()
{
   int A, B, X;
   scanf("%d %d", &A, &B);
   X = A + B;
   printf("X = %d\n", X);
   return 0;
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
10
9

Output

x
+
cmd
X = 19

#2 Code Example with Java Programming

Code - Java Programming

import java.util.Scanner;
public class Main {
 public static void main(String[] args) {
      int A, B, X;
      Scanner sc = new Scanner(System.in);
      A = sc.nextInt();                     // input for A
      B = sc.nextInt();                    // input for  B
      X = A + B;                           //Basic summation X = A + B
      System.out.print("X = "+X+"\n");    // Advised to give \n at last
   }
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
-10
4

Output

x
+
cmd
X = -6

#3 Run with PHP Programming Language

Code - PHP Programming


<?php
$input1 = intval(fgets(STDIN));
$input2 = intval(fgets(STDIN));
$summation = $input1 + $input2;

echo "X = $summation\n";
?>
Copy The Code & Try With Live Editor

Input

x
+
cmd
40 50

Output

x
+
cmd
X = 90
Advertisements

Demonstration


Problem Details:

URI Online Judge | 1001

Extremely Basic

Adapted by Neilor Tonin, URI  Brazil

Timelimit: 1

Read 2 variables, named A and B and make the sum of these two variables, assigning its result to the variable X. Print X as shown below. Print endline after the result otherwise you will get “Presentation Error”.

Input

The input file will contain 2 integer numbers.

Output

Print the letter X (uppercase) with a blank space before and after the equal signal followed by the value of X, according to the following example.

Obs.: don't forget the endline after all.

 
Samples Input Samples Output

10
9

X = 19

-10
4

X = -6

15
-7

X = 8

Previous
#1000 - Beecrowd Online judge solution 1000 in C, C++, Java, PHP, Python, Javascript, C#
Next
#1002 Beecrowd Online Judge solution 1002 - Solution in C, C++, Java, C# and Python - Circle of Area Solution