Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp18
- {
- internal class Program
- {
- private static void Main(string[] args)
- {
- #region #1
- for (int i1 = 0; i1 <= 10; i1++)
- {
- for (int i2 = 0; i2 <= 5; i2++)
- {
- for (int i5 = 0; i5 <= 2; i5++)
- {
- if (i1 + 2 * i2 + 5 * i5 == 10)
- {
- Console.WriteLine("jedynek = {0}\t dwójek = {1}\t piątek {2}", i1, i2, i5);
- }
- }
- }
- }
- Console.ReadKey();
- #endregion
- #region #2
- for (int x = 0; x <= 1000; x++)
- {
- for (int y = 0; y <= 500; y++)
- {
- for (int z = 0; z <= 200; z++)
- {
- if (x + 2 * y + 5 * z == 1000 && x == y && y == z && z == x)
- {
- Console.WriteLine("jedynek = {0}\t dwójek = {1}\t piątek {2}", x, y, z);
- }
- }
- }
- }
- Console.ReadKey();
- #endregion
- #region #3
- int suma = 0;
- for (int n = 1; n <= 10000; n++)
- {
- suma = 0;
- for (int i = 1; i < n; i++)
- {
- if (n % i == 0)
- {
- suma += i;
- }
- }
- if (suma == n)
- {
- Console.WriteLine(n + " jest liczbą doskonałą");
- }
- }
- Console.ReadKey();
- #endregion
- #region #4
- int i;
- Console.WriteLine("Podaj liczbę");
- int n = int.Parse(Console.ReadLine());
- for (i = 2; i < n; i++)
- {
- if (n % i == 0)
- {
- break;
- }
- }
- if (i == n)
- {
- Console.WriteLine(n + " jest liczbą pierwszą");
- }
- else
- {
- Console.WriteLine(n + " nie jest liczbą pierwszą");
- }
- Console.ReadKey();
- #endregion
- #region #5
- bool czyWagaNorma;
- double waga, wzrost, BMI;
- Console.Write("Podadaj wagę (w kg): ");
- waga = double.Parse(Console.ReadLine());
- Console.Write("Podadaj wzrost (w metrach): ");
- wzrost = double.Parse(Console.ReadLine());
- BMI = waga / Math.Pow(wzrost, 2.0);
- czyWagaNorma = BMI >= 18.5 && BMI < 25;
- Console.WriteLine("BMI = {0}", BMI);
- Console.WriteLine("Czy Twoja waga jest w normie - {0}", czyWagaNorma);
- Console.ReadKey();
- #endregion
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement