Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace INFLAB01
- {
- class Program
- {
- static void Main(string[] args) // ctrl K ctrl D
- {
- #region "Przyklad 1";
- //Console.WriteLine("Podaj swoje imię");
- //string imie = Console.ReadLine();
- //Console.WriteLine("Witaj: " + imie);
- //Console.ReadKey();
- #endregion
- #region "Przyklad2";
- //Int32 liczba;
- //Console.WriteLine("Podaj liczbe 123");
- //liczba = Convert.ToInt32(Console.ReadLine());
- //liczba = System.Int32.Parse(Console.ReadLine());
- ////liczba = Math.Abs(liczba);
- //Console.WriteLine(Math.Abs(liczba));
- //if (liczba<0)
- //{
- // liczba = -liczba;
- // Console.WriteLine(liczba);
- ////}
- ////else
- ////{
- //// Console.WriteLine(liczba);
- ////}
- #endregion
- #region "Przyklad3";
- //int a, b, c;
- //Console.WriteLine("podaj a b i c");
- //a = Convert.ToInt32(Console.ReadLine());
- //b = Convert.ToInt32(Console.ReadLine());
- //c = Convert.ToInt32(Console.ReadLine());
- //if (a > b)
- //{
- // if (a > c)
- // {
- // Console.WriteLine("A jest najwieksze" + a);
- // }
- // else
- // {
- // Console.WriteLine("C jest najwieksze" + c);
- // }
- //}
- //else
- //{
- // if (b > c)
- // {
- // Console.WriteLine("B jest najwieksze: " + b);
- // }
- // else
- // {
- // Console.WriteLine("C jest najwieksze: " + c);
- // }
- //}
- #endregion
- #region "Przyklad 4";
- //int i;
- //for(i=1; i <=3; i=i+2)
- //{
- // Console.WriteLine(i);
- //}
- //Console.ReadKey();
- #endregion
- #region "Zadanie 1";
- //Użytkownik podaje liczbę naturalną. Program wyświetla wszystkie dzielniki tej liczby.
- //int liczba;
- //Console.WriteLine("Podaj liczbe");
- //liczba = Convert.ToInt32(Console.ReadLine());
- //for (int i = 1; i <= liczba; i++)
- //{
- // if (liczba % i == 0)
- // {
- // Console.WriteLine(i);
- // }
- //}
- //Console.ReadKey();
- #endregion
- #region "Zadanie 2";
- //Użytkownik podaje dwie liczby a oraz b. Program oblicza potęga a do b.
- //int liczbaA;
- //int liczbaB;
- //int wynik;
- //Console.WriteLine("Podaj liczbe A - podstawe ");
- //liczbaA = Convert.ToInt32(Console.ReadLine());
- //Console.WriteLine("Podaj liczbe B - wykladnik");
- //liczbaB = Convert.ToInt32(Console.ReadLine());
- //wynik = liczbaA;
- //for (int i = 1; i<liczbaB; i++)
- //{
- // wynik = wynik * liczbaA;
- //}
- //Console.WriteLine(wynik);
- //Console.ReadKey();
- #endregion
- #region "Zadanie 3";
- //Użytkownik podaje liczbę naturalną n. Program oblicza, ile wynosi suma kolejnych liczb naturalnych od 1 do n..
- //int liczbaA;
- //int i;
- //int wynik=0;
- //Console.WriteLine("Podaj liczbe");
- //liczbaA = Convert.ToInt32(Console.ReadLine());
- //for (i = 1; i <= liczbaA; i++)
- //{
- // wynik += i;
- //}
- //Console.WriteLine(wynik);
- //Console.ReadKey();
- #endregion
- #region "Zadanie 4";
- //Użytkownik podaje liczbę naturalną. Program oblicza, ile kolejnych liczb naturalnych należy dodać, aby ich suma przekroczyła zadaną liczbę.
- //int liczbaA;
- //int i=0;
- //int suma=0;
- //Console.WriteLine("Podaj liczbe");
- //liczbaA = Convert.ToInt32(Console.ReadLine());
- //while(suma<=liczbaA)
- //{
- // i++;
- // Console.WriteLine("Twoje i po ++: " + i);
- // suma = suma + i;
- // Console.WriteLine("suma to: " + suma);
- //}
- //Console.WriteLine("Trzeba dodac "+ i + " liczb");
- //Console.ReadKey();
- #endregion
- #region "Zadanie 5";
- //Użytkownik podaje liczby naturalne a oraz b. Program wyświetla część całkowitą z dzielenia a / b..int liczba
- //int a;
- //int b;
- //int i = 0;
- //Console.WriteLine("Podaj liczbe a i b");
- //a = Convert.ToInt32(Console.ReadLine());
- //b = Convert.ToInt32(Console.ReadLine());
- //while(a>=b)
- // {
- // a = a - b;
- // i++;
- // Console.WriteLine("A to :" + a);
- // Console.WriteLine("I to :" + i);
- //}
- //Console.WriteLine(i);
- #endregion
- #region "Zadanie 6";
- //Użytkownik podaje 10 liczb. Program oblicza średnią arytmetyczną liczb dodatnich;
- //int a=0;
- //int i = 0;
- //double wynik=0;
- //while(i<10)
- //{
- // Console.WriteLine("Podaj liczbe a");
- // a = Convert.ToInt32(Console.ReadLine());
- // wynik = a + wynik;
- // i++;
- // //Console.WriteLine("I to: " + i);
- // //Console.WriteLine("A to: " + a);
- // //Console.WriteLine("W to: " + wynik);
- //}
- // //double wynikDouble = Convert.ToDouble(wynik);
- //Console.WriteLine("Wynik to: " + (wynik / 10));
- //Console.ReadKey();
- #endregion
- #region "Zadanie 7";
- //Liczba Pi 10000;
- //double i = 0;
- //double WynikPi=0;
- //for (i=0;i<=10000;i++)
- //{
- // WynikPi += Math.Pow(-1, i) / (2 * i + 1);
- //}
- //Console.WriteLine(WynikPi*4);
- //Console.ReadKey();
- #endregion
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement