Am nevoie urgent!!!!
Răspunsuri la întrebare
#include <iostream>
int input = 0;
bool kodd(int n){
if(n % 2 == 0) return true; else return false;
}
float media(int a, int b, int c){
return (a+b+c)/3;
}
int main(){
// Program 1
std::cout << "Program 1 :" << std::endl;
do { std::cout << "1) User input : "; std::cin >> input; } while(input <= 0);
for(int i = 1; i <= input; i++) if(kodd(i)) std::cout << i << " ";
for(int i = 0; i < 2; i++) std::cout << std::endl;
// Program 2
std::cout << "Program 2 :" << std::endl;
int a, b, c = 0; std::cout << "2) User input : " << std::endl;
std::cout << "n = "; std::cin >> input; std::cout << "a = "; std::cin >> a;
std::cout << "b = "; std::cin >> b; std::cout << "c = "; std::cin >> c;
if(media(a,b,c) > input) std::cout << "Media este mai mare ca n";
else std::cout << "Media este mai mica ca n";
for(int i = 0; i < 2; i++) std::cout << std::endl;
// Program 3
std::cout << "Program 3 :" << std::endl; std::cout << "2) User input : " << std::endl;
int m = 0; std::cout << "m = "; std::cin >> m; std::cout << "n = "; std::cin >> input;
if(m % input == 0) std::cout << "M este divizorul lui N"; else std::cout << "M nu este divizorul lui N";
// system("pause");
return 0;
}