Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace summ_cifr_v_chisle
- {
- class Program
- {
- static void Main(string[] args)
- {
- int x,b,summ=0;
- Console.Write("Введите число >>> ");
- x = int.Parse(Console.ReadLine());
- summ += x % 10;
- b = x / 10;
- while (b!=0)
- {
- summ += b % 10;
- b /= 10;
- }
- Console.Write("Сумма цифр >>> " + summ.ToString());
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement