1 solutions

  • 0
    @ 2025-11-5 17:31:49

    C :

    #include <stdio.h>
    
    int main(void) {
    	int a, b;
    	scanf("%d%d", &a, &b);
    	if(a > b)
    		printf("%d", a*a);
    	else
    		printf("%d", b*b);
    	return 0;
    }
    
    

    C++ :

    #include<cstdio>
    using namespace std;
    int main()
    {
    	int x1,x2;
    	scanf("%d%d",&x1,&x2);
    	if(x1>x2)
    	{
    		printf("%d\n",x1*x1);
    	}
    	else
    	{
    		printf("%d\n",x2*x2);
    	}
    	return 0;
    }
    

    Pascal :

    program y1;
     var
      a,b:integer;
     begin
      readln(a,b);
      if a>b then writeln(a*a)
               else writeln(b*b);
     end.
    
    
    • 1

    第三章:if选择结构《练习2:判断较大数的平方》

    Information

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