Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 1

#include<iostream.

h>
#include<fstream.h>
using namespace std;
int main()
{int n, v[30], lv=0, cat, rest,i;
ifstream f("numere.in");
ofstream g("numere.out"); f>>n;
while(n>2)
{
rest=n%2;
v[lv]=rest;
n=n/2;
lv++;
}
v[lv]=n;
for(i=lv; i>=0; i--)
g<<v[i];
f.close(); g.close();
}

You might also like