1 solutions

  • 0
    @ 2025-11-5 19:33:15

    C :

    #include <stdio.h>
    void main(){	
    	   int max(int x,int y,int z);
    	   int a,b,c,dmax;
    	   while(scanf("%d %d %d",&a,&b,&c)!=EOF){
    	      dmax=max(a,b,c);
    	      printf("%d\n",dmax);
    	    }
    }
    int max(int x,int y,int z)
    {	int m ,n;	
        if(x>y) m=x;
    	    else m=y;
    	    if(m>z) n=m;
    	    else n=z;
    	    return(n);
    }
    

    C++ :

    #include<iostream>
    using namespace std;
    int main(){
    	int a,b,c,result;
    	while(cin>>a>>b>>c){
    		if(a>b)
    			result = a;
    		else
    			result = b;
    		if(result<c)
    			result = c;
    		cout<<result<<endl;
    	}
    	return 0;
    	
    }
    

    Java :

    import java.util.Scanner;
    public class Main{
      public static void main(String[] args){
      	Scanner input = new Scanner(System.in);
        int a,b,c;
        while(input.hasNextInt()){
        a = input.nextInt();
        b = input.nextInt();
        c = input.nextInt();
        if (a > b && a > c)
          System.out.println(a);
        else if(b > a && b > c)
          System.out.println(b);
        else if(c > a && c > b)
          System.out.println(c);
          }
      }
    }
    

    Python :

    # coding=utf-8
    while True:
        try:
            l =input()
        except EOFError:
            break
        b=l.split()
        a=[]
        for i in b:
            a.append(int(i))
    
        j = len(a)
        m=a[0]
        for i in range(1,j):
            if a[i]>m:
                m=a[i]
        print(m)
    
    • 1

    Information

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