Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp19
  4.  
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             int IntV;
  11.             int finV;
  12.             int stepV;
  13.             Console.WriteLine("Please enter your initial value.");
  14.             IntV = int.Parse(Console.ReadLine());
  15.             Console.WriteLine("Please enter your final value.");
  16.             finV = int.Parse(Console.ReadLine());
  17.             Console.WriteLine("Please enter your step value.");
  18.             stepV = int.Parse(Console.ReadLine());
  19.  
  20.             for (int i = IntV; i < finV; i += stepV)
  21.             {
  22.                 Console.WriteLine("{0}", i);
  23.             }
  24.  
  25.             for (int i = IntV; i > finV; i -= stepV)
  26.             {
  27.                 Console.WriteLine("{0}", i);
  28.             }
  29.             Console.ReadKey();
  30.  
  31.         }
  32.  
  33.     }
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement