BojidarDosev

zad 7/359

Feb 28th, 2021 (edited)
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp1
  4. {
  5.     class Program
  6.     {
  7.         static int Reverse(int a)
  8.         {
  9.             int b = 0;
  10.             int c = 1;
  11.             int x;
  12.             int d = a;
  13.             while (d != 0)
  14.             {
  15.                 x = d % 10;
  16.                 b = b * 10 + x;
  17.                 d /= 10;
  18.                 Console.WriteLine("x = " + x + " b = " + b + " d = " + d + " c = " + c);
  19.             }
  20.             return b;
  21.         }
  22.    
  23.         static void Main(string[] args)
  24.         {
  25.         int a = int.Parse(Console.ReadLine());
  26.             int a1 = Reverse(a);
  27.             Console.WriteLine("reverse na a = " + a1);
  28.         }
  29.     }
  30. }
Add Comment
Please, Sign In to add comment