Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- ifstream f("date.in");
- ofstream g("date.out");
- int main()
- {
- int a[100][100],i,j,n,b,x,nr;
- f>>n>>b;
- for (i=1;i<=n;i++)
- for (j=1;j<=n;j++)
- {f>>a[i][j];
- if (i==j)
- {
- nr=0;
- x=a[i][j];
- while (x)
- {
- nr=nr*10+x%b;
- x=x/b;
- }
- a[i][j]=nr;
- }
- }
- for (i=1;i<=n;i++)
- {for (j=1;j<=n;j++)
- g<<a[i][j]<<" ";
- g<<'\n';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement