2 solutions

  • 0
    @ 2023-10-25 15:46:01
    #include<stdio.h>
    #include<math.h>
    #pragma warning(disable:4996) 
    int main()
    {
        int num,temp=0;
        scanf("%d",&num);
        do
        {
            temp = temp * 10 + num % 10;
            num /= 10;
        } while (num);
        printf("%d", temp);
        return 0;
    }
    
    • 0
      @ 2023-10-1 13:31:18
      #include<iostream>
      using namespace std;
      int main()
      {
          cin >> n;
      	if (n<0)
      	{
      		cout << "-";
      		n = -n;
      	}
      	for (; n; n/=10)
      	{
      		ans = n % 10 + ans * 10;
      		//cout << ans<<' ';
      	}
      	cout << ans;
      	return 0;
      }
      
      • 1

      Information

      ID
      6755
      Time
      1000ms
      Memory
      128MiB
      Difficulty
      8
      Tags
      (None)
      # Submissions
      370
      Accepted
      63
      Uploaded By