Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program that shows typical declarations, assignments and values stored in various types of variables

Posted By: Emma Brown     Category: C Programming     Views: 2343

Write a Program that shows typical declarations, assignments and values stored in various types of variables.

Code for Program that shows typical declarations, assignments and values stored in various types of variables in C Programming

main()                                                    
    {                                                         
    /*..........DECLARATIONS............................*/
float x, p ; double y, q ; unsigned k ; /*..........DECLARATIONS AND ASSIGNMENTS............*/
int m = 54321 ; longint n = 1234567890 ; /*..........ASSIGNMENTS.............................*/
x = 1.234567890000 ; y = 9.87654321 ; k = 54321 ; p = q = 1.0 ; /*..........PRINTING................................*/
printf("m = %d\n", m) ; printf("n = %ld\n", n) ; printf("x = %.12lf\n", x) ; printf("x = %f\n", x) ; printf("y = %.12lf\n",y) ; printf("y = %lf\n", y) ; printf("k = %u p = %f q = %.12lf\n", k, p, q) ; } Output m = -11215 n = 1234567890 x = 1.234567880630 x = 1.234568 y = 9.876543210000 y = 9.876543 k = 54321 p = 1.000000 q = 1.000000000000
  
Share: 



Emma Brown
Emma Brown author of Program that shows typical declarations, assignments and values stored in various types of variables is from London, United Kingdom.
 
View All Articles

 
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!