Advertisement
royroy23

Untitled

Jan 21st, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 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 ConsoleApplication21
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int num, dig, original,numdig;
  14. Console.WriteLine("Please enter a number: ");
  15. num = int.Parse(Console.ReadLine());
  16. Console.WriteLine("Please enter one digit: ");
  17. dig = int.Parse(Console.ReadLine());
  18. original = num;
  19. numdig = dig + 1;
  20. while (num > 0 && numdig != dig)
  21. {
  22. numdig = num % 10;
  23. num /= 10;
  24. }
  25. if (numdig != dig)
  26. Console.WriteLine((original / 10 * 10 + dig));
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement