Cálculo en C++

/* Compilar: $ g++ prog.cpp -o prog.o Ejecutar: $ ./prog */ #include <string> #include <iostream> #define MAX 10 using namespace std; int getCalculo(int numero){ return numero%3==0 && numero%5==0; } int main(){ int numeros[MAX] = {34,67,90,12,33,45,87,54,122,71}; cout<<"#Numeros:"<<endl; for(int i=0; i < MAX ;i++){ if(getCalculo(numeros[i]) == 0){ std::cout<<"CUMPLE = "<<numeros[i]<<endl; }else{ std::cout<<"NO CUMPLE = "<<numeros[i]<<endl; } } return 0; }
Compilar:
$ g++ prog.cpp -o prog.o

Ejecutar:
$ ./prog

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.