Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void Main(string[] args)
- {
- Console.WriteLine("Hello World!");
- int[] z = new int[5];
- int anz, i, zs, z2, ergebnis;
- ergebnis = 0;
- anz = 0;
- i = 1;
- zs = 0; // ??
- z2 = z[i]; // ??
- for (i = 1; i <= 4; i++) // i++ statt i = i + 1 !!
- {
- z[i] = int.Parse(Console.ReadLine());
- anz = anz + 1;
- while (zs > 0) // ?? Wärend des programms kommt man nie in dieser Schleife
- {
- zs = zs + (z2 % 10);
- z2 = z2 / 10;
- }
- }
- for (i = 1; i < z.Length; i++)
- {
- ergebnis += z[i];
- }
- Console.WriteLine("Ziffernsumme ist "+ergebnis);
- Console.ReadKey();
- }
Add Comment
Please, Sign In to add comment