Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int n = int.Parse(Console.ReadLine());
- int k = int.Parse(Console.ReadLine());
- int nsum = 0;
- if (n > 999 && n <= 9999)
- {
- while (n > 0)
- {
- int m = 0;
- m = n % 10;
- nsum += m;
- n /= 10;
- }
- }
- else
- {
- return;
- }
- if (k < nsum)
- {
- Console.WriteLine("ДА");
- Console.WriteLine(k + nsum);
- }
- else
- {
- Console.WriteLine("НЕ");
- Console.WriteLine(nsum);
- }
Advertisement
Add Comment
Please, Sign In to add comment