URI Solution 1198 Hashmat the Brave Warrior - Solution in C,C++,Java
URI Online Judge Solution | Mathematics
URI Main Problem Link - https://www.urionlinejudge.com.br/judge/en/problems/view/1198
Problem Name: URI Problem 1198 Hashmat the Brave Warrior
Problem Number : URI Problem 1198 Hashmat the Brave Warrior Solution
Online Judge : URI Online Judge Solution
Level: Mathematics
Solution Language : C, C plus plus, Java
URI Solution 1198 Hashmat the Brave Warrior Code in C:
#include <stdio.h> int main() { long long x, y; while(scanf("%lld", &x) != EOF) { scanf("%lld", &y); if(x > y) printf("%lld\n", x-y); else printf("%lld\n", y-x); } return 0; }
URI Solution 1198 Hashmat the Brave Warrior Code in CPP:
#include <iostream> using namespace std; int main() { long long x, y; while(cin >> x >> y) { if(x < y){ cout << y - x << endl; }else{ cout << x - y << endl; } } return 0; }
URI Solution 1198 Hashmat the Brave Warrior Code in Java:
import java.util.Scanner; public class Main { public static void main(String[] args) { long x, y; Scanner input = new Scanner(System.in); while(input.hasNext()) { x = input.nextLong(); y = input.nextLong(); if(x > y) System.out.println(x-y); else System.out.println(y-x); } } }
Tags: Uri solve , Uri solution, URI oj Solve, URI Online Judge Solution list, URI 1198 Solution, URI 1198 Solution in C, URI 1198 solution in java, URI 1198 solution in C++
No comments:
Write commentsTo know more about the problem, give us your valuable commment. We'll try to help you. Thanks