Guest User

Untitled

a guest
May 20th, 2018
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.01 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace Quersumme
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             int intEingabe, intRestwert, intDivision, intQuersumme, intBerechnung;
  13.  
  14.             intDivision = 0;
  15.             intRestwert = 0;
  16.  
  17.             Console.Write("\n\n\n\tGeben Sie eine Zahl ein: ");
  18.             intEingabe = Convert.ToInt32(Console.ReadLine());
  19.  
  20.             intBerechnung = intEingabe;
  21.            
  22.             for (int i = -10; i < intRestwert; i++)
  23.             {
  24.                 intRestwert = intBerechnung % 10;
  25.  
  26.                 if (intEingabe > 0)
  27.                 {
  28.                     intDivision = intBerechnung / 10;
  29.                 }
  30.  
  31.                 intBerechnung = intDivision;
  32.  
  33.                 if (intRestwert <= 0)
  34.                 {
  35.                     intEingabe = 0;
  36.                 }
  37.  
  38.                 Console.Write("\n\n\t{0}", intRestwert);
  39.             }
  40.         }
  41.     }
  42. }
Add Comment
Please, Sign In to add comment