Kod: Zaznacz cały
#include <cstdio>
#include <cstdlib>
#include <clocale>
#include <windows.h>
#include <iostream>
using namespace std;
void SetConsoleCP1250()
{
SetConsoleCP(1250);
SetConsoleOutputCP(1250);
setlocale(LC_ALL, "1250");
}
int AnalyzeNumbers(int , int , const int , const int )
{
int a,b;
for(int i=a;i<=b;i++)
{
for(int j=0;j<dividersCount;j++)
{
if(i%dividers[j]==0)
cout<<"Liczba "<<i<<" jest podzielna przez liczbę "<<dividers[j]<<endl;
else
cout<<"Liczba "<<i<<" nie jest podzielna przez liczbę "<<dividers[j]<<endl;
}
}
}
//******* UWAGA ********
//funkcji main() nie wolno zmieniać z wyjątkiem wartości liczbowych
int main()
{
const int dividersCount = 3;
const int dividers[dividersCount] = {3,5,7};
int analyzedNumbersCount = 0;
SetConsoleCP1250();
printf("
");
analyzedNumbersCount = AnalyzeNumbers(51, 54, dividersCount, dividers);
printf("
Przeanalizowano podzielność %d liczb.
Koniec programu.
", analyzedNumbersCount);
return 0;
}