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 _36AbsoluteWaarde
- {
- class Program
- {
- static void Main(string[] args)
- {
- int getal1;
- int getal2;
- int verschil;
- int max = 0;
- for (int i = 1; i <= 20; i=i+2)
- {
- Console.Write("getal " + i +": ");
- getal1 = int.Parse(Console.ReadLine());
- Console.Write("getal " + (i+1) + ": ");
- getal2 = int.Parse(Console.ReadLine());
- verschil = Math.Abs((getal1 - getal2));
- if (verschil > max)
- {
- max = verschil;
- }
- }
- Console.WriteLine("Het grootste absolute verschil van twee opvolgende getallen was: " + max);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement