Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- #include <string.h>
- int main(int argc, char *argv[]) {
- double var = 1233435.123;
- char string[10000];
- int i =0;
- int d, m = 0;
- sprintf(string, "%lf", var);
- for (; i<strlen(string) - 1; ++i){
- if(string[i+1] == '.'){
- d = string[i] - '0';
- }
- if(string[i] == '.'){
- m = string[i+1] - '0';
- break;
- }
- }
- printf("SUM(d+m) = %d", d+m);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement