Advertisement
tampurus

Unit 1.1 Floating to normalized floating point number

Mar 7th, 2022 (edited)
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     printf("Enter the number\n");
  6.     float f ; scanf("%f",&f);
  7.     int e = 0;
  8.    
  9.     if (f>=1){
  10.         while(f>=1){
  11.             f/=10;
  12.             e++;
  13.         }
  14.     }
  15.     else if (f<=0.1){
  16.         while(f<=0.1){
  17.             f*=10;
  18.             e--;
  19.         }
  20.     }
  21.     printf("\nNoramalized %f X 10^%d ",f,e);
  22.  
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement