1 solutions

  • 0
    @ 2025-11-5 15:45:01

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    long long a;
    int main()
    {
    	cin>>a;
    	cout<<abs(a);
    	
    	return 0;
    }
    

    Pascal :

    var n:longint;
    begin
     readln(n);
     writeln(abs(n));
    end.
    

    Java :

    import java.util.Scanner;
    
    public class Main {
      public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        while (cin.hasNext()) {
          int a = cin.nextInt();
          if(a>=0){
              System.out.println(a);
          }else{
              System.out.println(-a);
        }
      }
    }
    }
    
    • 1

    Information

    ID
    17123
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By