0

I have to create a program that separates mantissa and exponent from string. I managed to get exponent but not mantissa.

#include <stdlib.h> #include<stdio.h> #define SIZE 20 typedef struct{ double m; /* The mantissa component */ int expo; /* The exponent component */ } sci_not_t; /* Variable name*/ int main (void) { sci_not_t num; char input [SIZE]; printf("Please enter the number: "); scanf("%[^e]e%d", input, &num.expo); sscanf(input,"%1f",&num.m); printf("Exponent is: %d\nMantissa is:%e\n",num.expo,num.m); return 0; }

21st Dec 2017, 12:29 PM
Walleed Hesham
Walleed Hesham - avatar
1 Resposta
0
this isnt c#
23rd Jan 2018, 8:38 PM
John
John - avatar