Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Zadanie 1 wersja "for"
- #include <iostream>
- using namespace std;
- int main()
- {
- for (int i = 1; i <= 100; i++)
- {
- cout << i << endl;
- }
- return 0;
- }
- Zadanie 1 wersja "while"
- #include <iostream>
- using namespace std;
- int i = 1;
- int main()
- {
- while (i < 101);
- {
- cout << i;
- i++;
- }
- return 0;
- }
- Zadanie 1 wersja "dowhile"
- #include <iostream>
- using namespace std;
- int i = 1;
- int main()
- {
- do
- {
- cout << i << endl;
- i++;
- }while (i < 101);
- return 0;
- }
- Zadanie 2
- #include <iostream>
- using namespace std;
- int a, b;
- int main()
- {
- cout << "Wprowadz I kraniec przedzialu: ";
- cin >> a;
- cout << "Wprowadz II kraniec przedzialu: ";
- cin >> b;
- do
- {
- cout << a << endl;
- a++;
- } while (a <= b);
- return 0;
- }
- Zadanie 3
- #include <iostream>
- using namespace std;
- int n, i, b;
- int main()
- {
- cout << "Podaj liczbe z ktorej chcesz obliczyc silnie: " ;
- cin >> n;
- while (n < 0)
- {
- cout << "Nie mozna obliczyc z liczby ujemnej. Podaj liczbe nieujemna! ";
- cin >> n;
- }
- if (n == 0)
- {
- cout << "Silnia z Liczby" << n << "0!=1 " << endl;
- }
- else
- {
- b = 1;
- for (i = n; i >= 2; i = i - 1)
- {
- b = b * n;
- }
- cout << "Silnia wynosi:" << b;
- }
- return 0;
- }
- Zadanie 4
- #include <iostream>
- using namespace std;
- int a;
- int main()
- {
- cout << "Wyswietl wszystkie liczby dwucyfrowe " << endl;
- for (a = 10; a<= 99; a++)
- {
- if (a % 4 == 0)
- cout <<a<< endl;
- }
- return 0;
- }
- Zadanie 5
- #include <iostream>
- using namespace std;
- int a, i, n;
- int main()
- {
- cout << "Podaj pierwsza liczbe: ";
- cin >> n;
- cout << "Co ile ma przeskakiwac: ";
- cin >> a;
- for (int i = n; i <= 200; i = i + a)
- {
- cout << i << endl;
- }
- return 0;
- }
- Zadanie 6
- #include <iostream>
- using namespace std;
- int main() {
- cout << "Podaj 10 liczb" << endl;
- int suma = 0;
- for (int i = 1; i <= 10;i++)
- {
- cout << "Podaj " << i << " liczbe: ";
- int wprowadz = 0;
- cin >> wprowadz;
- suma += wprowadz;
- }
- cout << "Suma 10 liczb wynosi " << suma << endl;
- return 0;
- }
- Zadanie 7
- #include <iostream>
- using namespace std;
- float r, pole, obwod;
- int main()
- {
- do
- {
- cout << "Podaj promien: " ;
- cin >> r;
- } while (r <= 0);
- obwod = 2 * 3.14 * r;
- pole = 3.14 * r * r;
- cout << "Pole kola: " << pole << endl;
- cout << "Obwod kola: " << obwod << endl;
- return 0;
- }
- Zadanie 10
- #include <iostream>
- using namespace std;
- int szerokosc, wysokosc;
- int main()
- {
- cout << "Podaj szerokosc: ";
- cin >> szerokosc;
- cout << "Podaj wysokosc=: ";
- cin >> wysokosc;
- cout << endl;
- for (int i = 1; i <= wysokosc; i++)
- {
- for (int j = 1; j <= szerokosc; j++)
- cout << "*";
- cout << endl;
- }
- cout << endl;
- return 0;
- }
- Zadanie 12
- #include <iostream>
- using namespace std;
- int liczba, suma = 0, ilosc = 0;
- int main()
- {
- cout << "Podaj 10 liczb" << endl;
- for (int i = 1; i <= 10; i++)
- {
- cout << " Podaj " << i << " liczbe" << endl;
- cin >> liczba;
- suma = suma + liczba;
- ilosc++;
- if (suma > 50)
- {
- cout << "Suma podanych liczb przekroczyla 50" << endl;
- cout << "Podano " << ilosc << " liczb ktorych suma wyniosla " << suma << endl;
- return 0;
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment