1 solutions

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

    C :

    #include<stdio.h>
    int main()
    {
    	int i,a,b,c;
    	for(i=100;i<=999;i++)
    	{
    		a=i/100;
    		b=i/10%10;
    		c=i%10;
    		if(b>a&&b>c) printf("%d\n",i);
    	 } 
    	 return 0;
     } 
    

    C++ :

    #include <iostream>
    using namespace std;
    
    int main(){
    	int i;
    	for(i = 100;i <= 999;i++){
    		if(i/10%10>i/100&&i/10%10>i%10){
    			cout<<i<<endl;
    		}
    	}
    	
    }
    

    Java :

    //import java.util.Scanner;
    
    public class Main{
    
    public static void main(String[] agrs){
    
    //Scanner sc = new Scanner(System.in);
    //int n = sc.nextInt();
    
    for(int i = 100;i <= 999;i++){
    		if((i / 10 % 10 > i / 100) && (i / 10 % 10 > i % 10)){
    			System.out.println(i);
    		}
    }
    }
    }
    

    Python :

    for s in range(100, 999):
        b = s // 100 % 10
        sw = s // 10 % 10
        g = s // 1 % 10
        if sw > b and sw > g:
            print(s)
    
    
    • 1

    Information

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