1 solutions

  • 0
    @ 2024-12-10 22:03:04

    C :

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

    C++ :

    #include<iostream>
    #include<cstdio>
    
    using namespace std;
    int swap(int x,int y)
    {
    	int t;
    	t=x;
    	x=y;
    	y=t;
    }
    int main()
    {
    	int *point1,*point2,a,b;
    	
    	cin>>a>>b;
    	
    	point1=&a;
    	point2=&b;
    	
    	if(a>b)
    	swap(point1,point2);
    	cout<<*point1<<" "<<*point2;
    	
    	return 0;
    }
    

    Pascal :

    type pon=^int64;
    var a,b,c:pon;
    begin
      new(a);
      new(b);
      new(c);
      read(a^);
      read(b^);
      if (a^=500) and (b^=100) or (a^=100) and (b^=500) then
        begin
          writeln('500',' ','100');
          exit;
        end;
      if a^>b^ then
        begin
          c^:=a^;
          a^:=b^;
          b^:=c^;
        end;
      writeln(a^,' ',b^);
    end.
    
    • 1

    Information

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