Advertisement
vencinachev

StepLoop

Nov 20th, 2021
719
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Loops
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Console.Write("Enter lower number: ");
  14.             int low = int.Parse(Console.ReadLine());
  15.             Console.Write("Enter high number: ");
  16.             int high = int.Parse(Console.ReadLine());
  17.             Console.Write("Enter step: ");
  18.             int step = int.Parse(Console.ReadLine());
  19.  
  20.             for (int i = low; i <= high; i += step)
  21.             {
  22.                 Console.Write($"{i} ");
  23.             }
  24.             Console.WriteLine();
  25.         }
  26.     }
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement