Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include "math.h"
- #include <iomanip>
- using namespace std;
- int main()
- {
- double a;
- int n;
- int k;
- cout << "Enter number="; cin >> a;
- cout << "Enter n="; cin >> n;
- cout << "Enter k="; cin >> k;
- for (int i = 0; i < n; i++)
- {
- a *= 10;
- }
- int b;
- b = a;
- a -= b;
- int S = 0;
- for (int i = 0; i < k; i++)
- {
- int c;
- c = a * 10;
- S += c;
- a *= 10;
- a -= c;
- }
- cout << endl << "Answer:" << S << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement