0
The program if the number is divisible by 2 numbers tells me only 1
#include <stdio.h> #include <iostream> #include <math.h> int main() { using namespace std; //dichiarazione variabili int a; cout<<"Inserisci numero :"; cin>>a; if (a%3==0) cout<<"e' divisibile per 3 :"; else if (a%5==0) cout<<"e divisibile per 5 :"; else if (a%7==0) cout<<"e divisibile per 7 :"; else if (a%11==0) cout<<"e divisibile per 11 :"; else if (a%13==0) cout<<"e divisibile per 13 :"; else cout<<"il nume non e' divisibile per nessuno di questi numeri"; system("Pause"); }
4 odpowiedzi
+ 1
What problem you are facing here. Clarify first.
0
Doesn't work
#include <stdio.h>
#include <iostream>
#include <math.h>
int main()
{
using namespace std;
//dichiarazione variabili
int a;
cout<<"Inserisci numero :";
cin>>a;
if (a%3==0) { is_divisible true; cout < "divisible by 3\n; }
if (a%5==0) { is_divisible true; cout < "divisible by 5\n; }
if (a%7==0) { is_divisible true; cout < "divisible by 7\n; }
if (a%11==0) { is_divisible true; cout < "divisible by 11\n; }
if (a%13==0) { is_divisible true; cout < "divisible by 13\n; }
if (! is_divisible) { cout < "not divisible\n; }
system("Pause");
}