Cod sursa(job #2195500)
| Utilizator | Data | 16 aprilie 2018 16:00:12 | |
|---|---|---|---|
| Problema | Arbori de intervale | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.41 kb |
#include <iostream>
using namespace std;
int subAlg(int x, int b)
{
int s;
int nr_nou = 0;
cout<<"NUMAR INITIAL: "<<x<<" | BAZA: "<<b<<endl;
s = 0;
while (x > 0)
{
s = s + x % b;
nr_nou = nr_nou * 10 + x % b;
x = x/b;
}
cout<<"NUMAR RESCRIS: "<<nr_nou<<" | BAZA: "<<b<<endl;
cout<<"SUMA CIF ESTE: "<<s<<endl;
return (s % (b - 1) == 0);
}
int main()
{
cout<<subAlg(235, 6)<<endl;
}
