Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdbool.h>
- #include <stdlib.h>
- #include <math.h>
- #define SIZE 100
- int main()
- {
- char sign;
- int whole;
- double frac;
- double a;
- bool plus;
- print("Enter your number: ");
- scanf("%d", a);
- print("\n");
- if(a > 0)
- {
- plus = true;
- }
- else if (a < 0)
- {
- plus = false;
- }
- else
- {
- sign = '0';
- }
- int cele = a;
- whole = cele;
- double qwe;
- qwe = a - whole;
- qwe = qwe*10;
- int cele2 = qwe;
- frac = cele2;
- printf("Sign = ");
- if(plus == true)
- {
- printf ("+");
- }
- else if(plus == false)
- {
- printf ("-");
- }
- else
- {
- printf(sign);
- }
- printf("\n");
- printf("Whole = ");
- printf(whole);
- printf("\n");
- printf("Frac = ");
- printf(frac);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement