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 ConsoleApp3
- {
- class Program
- {
- static void Main(string[] args)
- {
- {
- int suma,liczba;
- Console.WriteLine("Podaj liczbę");
- liczba = Convert.ToInt32(Console.ReadLine());
- int wynik = 0;
- do
- {
- wynik = wynik + liczba % 10;
- liczba = liczba / 10;
- }
- while (liczba != 0);
- Console.WriteLine(wynik);
- Console.ReadKey();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement