1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
| #include <iostream>
#include <cmath>
using namespace std;
int nombreX (0); //initialisation de la valeur de la racine
int main()
{
cout << "Choississez la valeur de la racine : ";
cin >> nombreX;
int nombreW (0);
if (nombreX == 4 || 9 || 16 || 25 || 36 || 49 || 64 || 81 || 100 || 121 || 144 || 169 || 196 || 225 || 256 || 289 || 324 || 361 || 400 || 441 || 484 || 529)
{
nombreW = sqrt(nombreX);
cout << nombreW << " il s'agit d'un carre parfait, ne vous preoccupez pas du reste." << endl;
}
int nombreA(0);
for (nombreA = 150; nombreA > 2; nombreA--)
{
int nombreY (nombreX%nombreA); //nombre Y egal soit 1 soit 0
int nombreZ (nombreX/nombreA);
if (nombreY == 0)
{
cout << nombreA << " X " << nombreZ << endl;
}
else
{
cout << "erreur" << endl;
}
}
int nombreB (0);
int nombreC (0);
int nombreGauche1 (1);
int nombreGauche2 (0);
int nombreDroite1 (0);
int nombreDroite2 (0);
cout << "Indiquer le premier facteur PPCM" << endl;
cin >> nombreB;
cout << "Indiquer le deuxieme facteur PPCM" << endl;
cin >> nombreC;
if (nombreB == 4 || 9 || 16 || 25 || 36 || 49 || 64 || 81 || 100 || 121 || 144 || 169 || 196 || 225 || 256 || 289 || 324 || 361 || 400 || 441 || 484 || 529)
{
nombreGauche1 = sqrt(nombreB);
}
else
{
nombreDroite1 = nombreB;
}
if (nombreC == 4 || 9 || 16 || 25 || 36 || 49 || 64 || 81 || 100 || 121 || 144 || 169 || 196 || 225 || 256 || 289 || 324 || 361 || 400 || 441 || 484 || 529)
{
nombreGauche2 = sqrt(nombreC);
}
else
{
nombreDroite2 = nombreC;
}
cout << nombreGauche1 << " X " << nombreGauche2 << ";" << nombreDroite1 << " X " << nombreDroite2 << endl;
return 0;
} |
Partager