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 _3_név
- {
- class Program
- {
- static void Main(string[] args)
- {
- while (true)
- {
- Console.Clear();
- Console.WriteLine("1. 3 név if-ekkel");
- Console.WriteLine("3. első 100 szám");
- Console.WriteLine("4. első 100 szám közül a párosak");
- Console.WriteLine("5. első 100 szám közül a páratlanok");
- Console.WriteLine("6. számok kiiratása 2 oszlopba");
- Console.WriteLine("7. számok és betűk kiiratása 2 oszlopba");
- int s = int.Parse(Console.ReadLine());
- switch (s)
- {
- case 1:
- Console.WriteLine("Írjon be 3 nevet: ");
- string x = Console.ReadLine();
- string y = Console.ReadLine();
- string z = Console.ReadLine();
- int a = x.Length;
- int b = y.Length;
- int c = z.Length;
- Console.WriteLine("A nevek hossza csökkenő sorrendben: ");
- if (c < b && b < a)
- {
- Console.WriteLine("{0}, {1}, {2}", x, y, z);
- }
- if (b < c && c < a)
- {
- Console.WriteLine("{0}, {1}, {2}", x, z, y);
- }
- if (c < a && a < b)
- {
- Console.WriteLine("{0}, {1}, {2}", y, x, z);
- }
- if (a < c && c < b)
- {
- Console.WriteLine("{0}, {1}, {2}", y, z, x);
- }
- if (b < a && a < c)
- {
- Console.WriteLine("{0}, {1}, {2}", z, x, y);
- }
- if (a < b && b < c)
- {
- Console.WriteLine("{0}, {1}, {2}", z, y, x);
- }
- Console.ReadKey();
- break;
- case 2:
- Console.Write("Írjon be 3 nevet: ");
- string x1 = Console.ReadLine();
- string y1 = Console.ReadLine();
- string z1 = Console.ReadLine();
- int a1 = x1.Length;
- int b1 = y1.Length;
- int c1 = z1.Length;
- if (c1 < b1 && b1 < a1)
- {
- Console.WriteLine("{0}, {1}, {2}", x1, y1, z1);
- }
- if (b1 < c1 && c1 < a1)
- {
- Console.WriteLine("{0}, {1}, {2}", x1, z1, y1);
- }
- if (c1 < a1 && a1 < b1)
- {
- Console.WriteLine("{0}, {1}, {2}", y1, x1, z1);
- }
- if (a1 < c1 && c1 < b1)
- {
- Console.WriteLine("{0}, {1}, {2}", y1, z1, x1);
- }
- if (b1 < a1 && a1 < c1)
- {
- Console.WriteLine("{0}, {1}, {2}", z1, x1, y1);
- }
- if (a1 < b1 && b1 < c1)
- {
- Console.WriteLine("{0}, {1}, {2}", z1, y1, x1);
- }
- Console.ReadKey();
- break;
- case 3:
- for (int i = 0; i < 100; i++)
- {
- Console.WriteLine(i);
- }
- Console.ReadKey();
- break;
- case 4:
- for (int i = 0; i < 100; i += 2)
- {
- Console.WriteLine(i);
- }
- Console.ReadKey();
- break;
- case 5:
- for (int i = 1; i < 100; i += 2)
- {
- Console.WriteLine(i);
- }
- Console.ReadKey();
- break;
- case 6:
- for (int i = 0; i < 11; i++)
- {
- Console.WriteLine("{0}:{1}", i, i * 2);
- }
- Console.ReadKey();
- break;
- case 7:
- int k = 0;
- for (char i = 'a'; i <= 'z'; i++)
- {
- Console.WriteLine("{0} : {1}", k, i);
- k++;
- }
- Console.ReadKey();
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement