dosseva

Mine_EX1_ReverseNums

Apr 16th, 2021
802
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace EX1
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             Console.WriteLine("====== Задача 1 - Кристин Досева ======");
  10.             Console.WriteLine();
  11.             Console.Write("Напишете цяло число \n");
  12.             int num = int.Parse(Console.ReadLine());
  13.             int temp = 0;
  14.             int remainder = 0;
  15.             int reverse = 0;
  16.            
  17.             temp = num;
  18.  
  19.             while (num > 0)
  20.             {
  21.                 remainder = num % 10;
  22.                 reverse = reverse * 10 + remainder;
  23.                 num /= 10;
  24.             }
  25.             Console.WriteLine();
  26.             Console.WriteLine($"Числото = {temp}");
  27.             Console.WriteLine($"Обърнато = {reverse}");
  28.             Console.WriteLine($"Краен резултат = {temp + reverse}");
  29.         }
  30.     }
  31. }
  32.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×