Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » BeginnersRSS Feeds

Reading of real numbers

Posted By: Redmond Fischer     Category: C Programming     Views: 4531

Program for Reading of real numbers.

Code for Reading of real numbers in C Programming

   main()                                                      
   {                                                  
       float x,y;                                              
       double p,q;                                             
       printf("Values of x and y:");                           
       scanf("%f %e", &x, &y);                                 
       printf("\n");                                           
       printf("x = %f\ny = %f\n\n", x, y);                     
       printf("Values of p and q:");                           
       scanf("%lf %lf", &p, &q);                               
       printf("\np = %lf\nq = %e",p,q);                        
       printf("\n\np = %.12lf\np = %.12e", p,q);               
   }                                                           

Output                                                      
                                                               
   Values of x and y:12.3456  17.5e-2                          
   x = 12.345600                                               
   y = 0.175000                                                
   Values of p and q:4.142857142857  18.5678901234567890       
   p = 4.142857142857                                          
   q = 1.856789012346e+001                                     
  
Share: 


Didn't find what you were looking for? Find more on Reading of real numbers Or get search suggestion and latest updates.

Redmond Fischer
Redmond Fischer author of Reading of real numbers is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!