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 HelloWorld
- {
- class Program
- {
- static void Main(string[] args)
- {
- int age = 50;
- int colegeTest = 10 + ++age;
- age +=23;
- int test2 = 10 + 34* 8;
- char firstLetter = 'S';
- float myMoney = 2.34f;
- string name = "Stoyan";
- sbyte test = -128;
- bool isMail = true;
- object myObject = 5;
- int result = age + test;
- bool logResult = age < test;
- Console.WriteLine("Hello World! I am " + age + " years old. My name starts with " + firstLetter + "My money " + myMoney);
- Console.WriteLine("My name is " + name + test);
- Console.WriteLine("My I a mail: " + isMail);
- Console.WriteLine("Result " + result);
- Console.WriteLine("loResult " + logResult);
- Console.WriteLine("colege " + colegeTest);
- // string readCOnsole = Console.ReadLine();
- // Console.WriteLine("You have entered " + int.Parse(readCOnsole));
- Console.WriteLine("Please eneter your age: ");
- int userAge = int.Parse(Console.ReadLine());
- /*
- if (userAge < 20)
- {
- Console.WriteLine("You are an teenager!!!");
- }
- else if (userAge < 50 && userAge > 30) {
- Console.WriteLine("You are in the middle age");
- }
- else {
- Console.WriteLine("You are not in our age ranges");
- }
- */
- switch (userAge)
- {
- case 20:
- Console.WriteLine("You are 20 years old");
- break;
- default:
- Console.WriteLine("Nothing else matches");
- break;
- }
- Console.WriteLine(1);
- Console.WriteLine(2);
- Console.WriteLine(3);
- int i = 1;
- while (i <= 10) {
- if (i == 5) break;
- Console.WriteLine(i);
- i++;
- }
- Console.WriteLine("Please choose [1-4]:");
- Console.WriteLine("1. List all partiotions");
- Console.WriteLine("2. Create a partiotn");
- Console.WriteLine("3. Deletae a partition");
- Console.WriteLine("4. Exit");
- string choice = "";
- while (true) {
- choice = Console.ReadLine();
- if (choice == "4") {
- break;
- }
- }
- i = 11;
- do
- {
- Console.WriteLine("do: {0}", i);
- i++;
- } while (i <= 10);
- for (i = 0; i < 10; i++) {
- if (i % 2 != 1) continue;
- Console.WriteLine("for: {0} ", i);
- }
- string[] group1a = { "Rayna", "Mimi", "Velina", "Svetlin", "Aysun", "Maria", "Geri", "Marin", "Plamen" };
- Console.WriteLine("The list of group 1a:");
- foreach (string nameGr in group1a) {
- Console.WriteLine(nameGr);
- }
- int k;
- for (i = 0, k = 10; i < 10; i++) {
- for (int j = 0; j < i; j++) {
- Console.Write("*");
- }
- Console.WriteLine();
- }
- /* // 1)
- int[] myArray;
- myArray = new int[5];
- myArray[4] = 43;
- */
- // 2)
- // int[] myArray = { 34, 45, 56 };
- int[] myArray = new int[4] { 23, 45, 56, 78 };
- for (i = 0; i < myArray.Length; i++) {
- Console.WriteLine("myArray[{1}] = {0}", myArray[i], i);
- }
- string[,] positionsOfTheStudents = {
- {"", "Rayna","","","Mimi","", "Velina",""},
- {"", "Svetlin","","Aisun","Maria","", "","Geri"},
- {"", "","","","Marin","", "Plamen",""}
- };
- for (i = 0; i < positionsOfTheStudents.GetLength(0); i++)
- {
- Console.Write("Red {0}: ", i);
- for (int j = 0; j < positionsOfTheStudents.GetLength(1); j++)
- {
- Console.Write(" {0}", positionsOfTheStudents[i, j]);
- }
- Console.WriteLine();
- }
- int[][] jaggedArray;
- jaggedArray = new int[2][];
- jaggedArray[0] = new int[8];
- jaggedArray[1] = new int[5];
- /*
- string temp = "";
- for (i = 0; i < 10; i++)
- {
- temp += "*"; // "*";
- }
- Console.WriteLine(temp);
- for (i = 0; i < 14; i++)
- {
- temp += "@"; // "*";
- }
- Console.WriteLine(temp);
- */
- Console.WriteLine(createString(2));
- Console.WriteLine(createString(20, "@"));
- Console.WriteLine(createString());
- Console.WriteLine(createString(10, "^", "Rayna", "Mimi"));
- Console.WriteLine(factorial(2));
- }
- static string createString(int strLength, string str = "*", params string[] par)
- {
- string temp = "";
- for (int i = 0; i < strLength; i++)
- {
- temp += str;
- }
- foreach (string item in par)
- {
- Console.WriteLine(item);
- }
- return temp;
- }
- static string createString() {
- return "Hhahaah";
- }
- static int factorial(int n)
- {
- if (n == 0) return 1;
- return factorial(n - 1) * n;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement