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;
- namespace egor_prac4_z3_var11
- {
- class Program
- {
- static void Main(string[] args)
- {
- int a, b, x, y, i;
- Console.Write("from A to B which ends with X or Y\n\nEnter\nA = ");
- a = int.Parse(Console.ReadLine());
- Console.Write("B = ");
- b = int.Parse(Console.ReadLine());
- Console.Write("X = ");
- x = int.Parse(Console.ReadLine());
- Console.Write("Y = ");
- y = int.Parse(Console.ReadLine());
- Console.Write("\nfor:\n");
- for (i = a; i <= b; i++)
- {
- if (i % 10 == x || i % 10 == y)
- {
- Console.Write(i + " ");
- }
- }
- Console.Write("\n\nwhile:\n");
- i = a;
- while(i <= b)
- {
- if (i % 10 == x || i % 10 == y)
- {
- Console.Write(i + " ");
- }
- i++;
- }
- Console.Write("\n\ndo-while:\n");
- i = a;
- do
- {
- if (i % 10 == x || i % 10 == y)
- {
- Console.Write(i + " ");
- }
- } while (i++ < b);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement