Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //#1
- int girls = 0, boys = 0, mone = 0;
- while (girls != -1 && boys != -1)
- {
- boys = int.Parse(Console.ReadLine());
- girls = int.Parse(Console.ReadLine());
- if (boys == girls)
- mone++;
- }
- Console.WriteLine(mone);
- //#2
- Random rnd = new Random();
- int x, y, z;
- x = int.Parse(Console.ReadLine());
- y = int.Parse(Console.ReadLine());
- while (x != 0 && y != 0)
- {
- if (x > y)
- z = rnd.Next(y + 1, x);
- else
- z = rnd.Next(x + 1, y);
- Console.WriteLine(z);
- x = int.Parse(Console.ReadLine());
- y = int.Parse(Console.ReadLine());
- }
- //#3
- int x, sum = 0, mone = 0;
- x = int.Parse(Console.ReadLine());
- while (x != 1000 && x > 999 && x < 10000)
- {
- if (x % 10 > x / 100 % 10)
- sum += x;
- if (x / 10 % 10 % 2 == 0 && x / 1000 == 1)
- mone++;
- x = int.Parse(Console.ReadLine());
- }
- Console.WriteLine("{0} {1}", sum, mone);
- //#4
- int x;
- x = int.Parse(Console.ReadLine());
- while (x > 9 && x < 100)
- {
- if (x / 10 + 2 == x % 10)
- Console.WriteLine(x);
- x = int.Parse(Console.ReadLine());
- }
- //#5
- int x;
- x = int.Parse(Console.ReadLine());
- while (x != 0)
- {
- int i;
- string r = "rishoni";
- for (i = 2; i < x; i++)
- {
- if (x % i == 0)
- r = "lo";
- }
- if (x==1)
- r="lo";
- Console.WriteLine(r);
- x = int.Parse(Console.ReadLine());
- }
- //#6
- int x, digits = 1, sum=0;
- x = int.Parse(Console.ReadLine());
- while (x != -1) {
- while (x / 10 != 0)
- {
- digits++;
- sum += x % 10;
- x /= 10;
- }
- sum += x % 10;
- Console.WriteLine("number of digits: {0}, sum of digits: {1}", digits, sum);
- x = int.Parse(Console.ReadLine());
- digits = 1;
- sum = 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement