Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<iomanip>
- using namespace std;
- void main()
- {
- double nmb;
- cin >> nmb;
- // Кол-во чисел после запятых равно:
- cout << (nmb - (int)nmb) << endl;
- // Само число равно
- while (nmb - (int)nmb != 0)
- {
- cout << nmb << endl;
- nmb *= 10;
- }
- cout << "Result number is " << nmb << endl;
- system("pause");
- }
- int fractional_part_as_int(double number, int number_of_decimal_places) {
- double dummy;
- double frac = modf(number,&dummy);
- return round(frac*pow(10,number_of_decimal_places));
- }
Add Comment
Please, Sign In to add comment