1 solutions

  • 0
    @ 2025-3-3 16:33:40

    C :

    #include<stdio.h>
    
    void main(){
    	int n;
    	int m;
    	scanf("%d",&n);
    	
    	if(n>0){
    		m=n;
    	}else if(n<0){
    		m=-1*n;
    	}
    	printf("%d",m);
    } 
    

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    int main(){
        int n;
        cin>>n;
        if(n==0){
        	cout<<0<<endl;
    	}else{
    		cout<<abs(n)<<endl;
    	}
    }
    

    Python :

    a=int(input())
    print(abs(a))
    
    • 1

    Information

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