Advertisement
royroy23

Untitled

Jan 19th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication19
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int num, dig, original, numdig;
  14. bool a = false;
  15. Console.WriteLine("Please enter a number: ");
  16. num = int.Parse(Console.ReadLine());
  17. Console.WriteLine("Please enter one digit: ");
  18. dig = int.Parse(Console.ReadLine());
  19. original = num;
  20. while (num > 0 && a == false)
  21. {
  22. numdig = num % 10;
  23. num /= 10;
  24. if (numdig == dig)
  25. a = true;
  26. }
  27. if (a == true)
  28. Console.WriteLine((original * 10 + dig));
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement