Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdio.h>
- #define N 100
- struct _Decimal
- {
- char a[N];
- unsigned int n;
- };
- typedef struct _Decimal Decimal;
- void div10(Decimal* res, const Decimal* b)
- {
- unsigned int n = b->n;
- res->a[0] = b->a[n - 1];
- res->a[1] = b->a[n];
- }
- int main(){
- Decimal a = {{7, 4, 1}, 2}; // set number 147
- Decimal res;
- div10(&res, &a); // res = a/10 = 147/10 = 14
- printf("%u", &res); // print 14
- printf("\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement