Level 1.2
#include
using namespace std;
int cem(int a, int b) {
return a + b;
}
int ferq(int a, int b) {
return a - b;
}
int hasil(int a, int b) {
return a * b;
}
double qismet(int a, int b) {
if (b == 0)
return 0; // 0-a bölmə yoxdur
return (double)a / b;
}
int main() {
int x, y;
cout << "Iki tam eded daxil edin: ";
cin >> x >> y;
cout << "Cem: " << cem(x, y) << endl;
cout << "Ferq: " << ferq(x, y) << endl;
cout << "Hasil: " << hasil(x, y) << endl;
if (y != 0)
cout << "Qismet: " << qismet(x, y) << endl;
else
cout << "Qismet: Bolme mumkun deyil!" << endl;
return 0;
}
Level 1.4
#include
using namespace std;
const double PI = 3.14159;
double sahe(double r) {
return PI * r * r;
}
double cevre(double r) {
return 2 * PI * r;
}
int main() {
double r;
cout << "Dairenin radiusunu daxil edin: ";
cin >> r;
cout << "Sahesi: " << sahe(r) << endl;
cout << "Cevresi: " << cevre(r) << endl;
return 0;
}
Level 1.8
#include
using namespace std;
// Kvadratin sahəsini hesablayan funksiya
int sahe(int a) {
return a * a;
}
// Kvadratin perimetrini hesablayan funksiya
int perimetr(int a) {
return 4 * a;
}
int main() {
int teref;
cout << "Kvadratin terefini daxil edin: ";
cin >> teref;
cout << "Sahesi: " << sahe(teref) << endl;
cout << "Perimetri: " << perimetr(teref) << endl;
return 0;
}
Level 2.2
#include
using namespace std;
string yoxla(int a) {
if (a > 0) return "Musbet";
else if (a < 0) return "Menfi";
else return "0";
}
int main() {
int x;
cout << "Bir eded daxil edin: ";
cin >> x;
cout << "Eded: " << yoxla(x) << endl;
return 0;
}
Level 2.3
#include
using namespace std;
int enBoyuk(int a, int b, int c) {
int max = a;
if (b > max) max = b;
if (c > max) max = c;
return max;
}
int main() {
int x, y, z;
cout << "3 eded daxil edin: ";
cin >> x >> y >> z;
cout << "En boyuk eded: " << enBoyuk(x, y, z) << endl;
return 0;
}
Level 2.4
#include
using namespace std;
bool cutdur(int a) {
return a % 2 == 0;
}
int main() {
int x;
cout << "Bir eded daxil edin: ";
cin >> x;
if (cutdur(x))
cout << "Cut ededdir." << endl;
else
cout << "Tek ededdir." << endl;
return 0;
}
Level 3.1
#include
using namespace std;
// 1-dən 10-a qədər ədədləri qaytaran funksiya
int ededler(int n) {
return n; // sadəcə ədədi qaytarır
}
int main() {
cout << "1-den 10-a qeder ededler:" << endl;
for (int i = 1; i <= 10; i++) {
cout << ededler(i) << " ";
}
cout << endl;
return 0;
}
Level 3.3
#include
using namespace std;
// 1-dən 100-ə qədər ədədlərin cəmini qaytaran funksiya
int cem() {
int toplam = 0;
for (int i = 1; i <= 100; i++) {
toplam += i;
}
return toplam;
}
int main() {
cout << "1-den 100-e qeder ededlerin cemi: " << cem() << endl;
return 0;
}
Level 3.8
#include
using namespace std;
// Ədədin tərsini qaytaran funksiya
int ters(int a) {
return -a;
}
int main() {
int eded;
cout << "Bir eded daxil edin: ";
cin >> eded;
cout << "Ededin tersi: " << ters(eded) << endl;
return 0;
}
Level 4.2
#include
using namespace std;
// Ədədin rəqəmlərinin sayını qaytaran funksiya
int reqemSay(int a) {
if (a == 0) return 1; // 0-ın rəqəm sayı 1-dir
int say = 0;
if (a < 0) a = -a; // mənfi ədəd üçün müsbətə çeviririk
while (a > 0) {
a /= 10;
say++;
}
return say;
}
int main() {
int eded;
cout << "Bir eded daxil edin: ";
cin >> eded;
cout << "Ededin reqemlerinin sayi: " << reqemSay(eded) << endl;
return 0;
}
Level 1.2
#include
using namespace std;
int cem(int a, int b) {
return a + b;
}
int ferq(int a, int b) {
return a - b;
}
int hasil(int a, int b) {
return a * b;
}
double qismet(int a, int b) {
if (b == 0)
return 0; // 0-a bölmə yoxdur
return (double)a / b;
}
int main() {
int x, y;
cout << "Iki tam eded daxil edin: ";
cin >> x >> y;
}
Level 1.4
#include
using namespace std;
const double PI = 3.14159;
double sahe(double r) {
return PI * r * r;
}
double cevre(double r) {
return 2 * PI * r;
}
int main() {
double r;
cout << "Dairenin radiusunu daxil edin: ";
cin >> r;
}
Level 1.8
#include
using namespace std;
// Kvadratin sahəsini hesablayan funksiya
int sahe(int a) {
return a * a;
}
// Kvadratin perimetrini hesablayan funksiya
int perimetr(int a) {
return 4 * a;
}
int main() {
int teref;
cout << "Kvadratin terefini daxil edin: ";
cin >> teref;
}
Level 2.2
#include
using namespace std;
string yoxla(int a) {
if (a > 0) return "Musbet";
else if (a < 0) return "Menfi";
else return "0";
}
int main() {
int x;
cout << "Bir eded daxil edin: ";
cin >> x;
}
Level 2.3
#include
using namespace std;
int enBoyuk(int a, int b, int c) {
int max = a;
}
int main() {
int x, y, z;
cout << "3 eded daxil edin: ";
cin >> x >> y >> z;
}
Level 2.4
#include
using namespace std;
bool cutdur(int a) {
return a % 2 == 0;
}
int main() {
int x;
cout << "Bir eded daxil edin: ";
cin >> x;
}
Level 3.1
#include
using namespace std;
// 1-dən 10-a qədər ədədləri qaytaran funksiya
int ededler(int n) {
return n; // sadəcə ədədi qaytarır
}
int main() {
cout << "1-den 10-a qeder ededler:" << endl;
}
Level 3.3
#include
using namespace std;
// 1-dən 100-ə qədər ədədlərin cəmini qaytaran funksiya
int cem() {
int toplam = 0;
for (int i = 1; i <= 100; i++) {
toplam += i;
}
return toplam;
}
int main() {
cout << "1-den 100-e qeder ededlerin cemi: " << cem() << endl;
return 0;
}
Level 3.8
#include
using namespace std;
// Ədədin tərsini qaytaran funksiya
int ters(int a) {
return -a;
}
int main() {
int eded;
cout << "Bir eded daxil edin: ";
cin >> eded;
}
Level 4.2
#include
using namespace std;
// Ədədin rəqəmlərinin sayını qaytaran funksiya
int reqemSay(int a) {
if (a == 0) return 1; // 0-ın rəqəm sayı 1-dir
}
int main() {
int eded;
cout << "Bir eded daxil edin: ";
cin >> eded;
}