Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as C++ by Chris ( 13 years ago )
// cos.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
double dzielenie(int a, int b)
{
return a/b;
}
int podzielniki(int doIlu, int tablica[])
{
int i=1;
int ilosc = 0;
tablica[0]=0;
while (i<=doIlu)
{
if (doIlu % i == 0)
{
tablica[0]++;
ilosc++;
tablica[ilosc]=i;
}
i++;
}
return ilosc;
}
int main()
{
system("chcp 1250");
system("cls");
int tablicaDzielnikow[100];
int tab1[5], tab2[5];
tab1[0] = 5;
tab1[1] = 10;
tab1[2] = 15;
tab1[3] = 20;
tab1[4] = 25;
for (int i = 0; i <100; i++) tablicaDzielnikow[i]=0;
//int doIlu = 0;
//cout << "Podaj liczbę: ";
//cin >> doIlu;
cout << "---- W Y N I K I ---" << endl << endl;
for (int i=0; i<=4; i++)
{
tab2[i]=podzielniki (tab1[i], tablicaDzielnikow);
}
/*for (int i=1; i <=ile ; i++)
{
cout << "Dzielnik = " << tablicaDzielnikow[i] << endl;
}
cout << "liczba podzielników równa: " << tablicaDzielnikow[0] << endl << endl;
*/
for (int j=0; j<=4; j++)
{
cout << "Liczba " << tab1[j] << " ma podzielników " << tab2[j] << endl;
}
system("pause");
return 0;
}
Revise this Paste