1.
#include <iostream>
using namespace std;
int main() {
cout << ".-------------------------------." << endl;
cout << "| Imię | Nazwisko |" << endl;
cout << ":-------------------------------:" << endl;
cout << "| Jan | Kowalski |" << endl;
cout << "| Ewa | Farna |" << endl;
cout << "| Adam | Bodnar |" << endl;
cout << "| James | Bond |" << endl;
return 0;
}
2.
#include <cmath>
float r, h;
cout << "Promien podstawy stozka: ";
cin >> r;
cout << "Wysokosc stozka: ";
cin >> h;
cout << "Objetosc stozka: " << M_PI * pow(r, 2) * h / 3 << endl;
cout << "Powierzchnia stozka: " << M_PI * (sqrt(pow(h, 2) + pow(r, 2)) * r + pow(r, 2)) << endl;
3.
float x;
cout << "Podaj liczbe: ";
cin >> x;
if (x <= 20) cout << pow(x, 4);
4.
for (int i = 2; i < 15; i++) cout << pow(i, 3) << endl;
5.
int suma(int n) {
int wynik = 0;
for (int i = 1; i <= n; i++) wynik += i;
return wynik;
int x;
cout << suma(x) << endl;
" Life is not a problem to be solved but a reality to be experienced! "
© Copyright 2013 - 2024 KUDO.TIPS - All rights reserved.
1.
#include <iostream>
using namespace std;
int main() {
cout << ".-------------------------------." << endl;
cout << "| Imię | Nazwisko |" << endl;
cout << ":-------------------------------:" << endl;
cout << "| Jan | Kowalski |" << endl;
cout << "| Ewa | Farna |" << endl;
cout << "| Adam | Bodnar |" << endl;
cout << "| James | Bond |" << endl;
cout << ".-------------------------------." << endl;
return 0;
}
2.
#include <iostream>
#include <cmath>
using namespace std;
int main() {
float r, h;
cout << "Promien podstawy stozka: ";
cin >> r;
cout << "Wysokosc stozka: ";
cin >> h;
cout << "Objetosc stozka: " << M_PI * pow(r, 2) * h / 3 << endl;
cout << "Powierzchnia stozka: " << M_PI * (sqrt(pow(h, 2) + pow(r, 2)) * r + pow(r, 2)) << endl;
return 0;
}
3.
#include <iostream>
#include <cmath>
using namespace std;
int main() {
float x;
cout << "Podaj liczbe: ";
cin >> x;
if (x <= 20) cout << pow(x, 4);
return 0;
}
4.
#include <iostream>
#include <cmath>
using namespace std;
int main() {
for (int i = 2; i < 15; i++) cout << pow(i, 3) << endl;
return 0;
}
5.
#include <iostream>
using namespace std;
int suma(int n) {
int wynik = 0;
for (int i = 1; i <= n; i++) wynik += i;
return wynik;
}
int main() {
int x;
cout << "Podaj liczbe: ";
cin >> x;
cout << suma(x) << endl;
return 0;
}