Logo 
Search:

C Programming Articles

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

Program that illustrates arithmetic operators

Posted By: Ludvig Fischer     Category: C Programming     Views: 2583

Write a Program that illustrates arithmetic operators.

Code for Program that illustrates arithmetic operators in C Programming

   main()                                                      
   {                                                           
       int a, b, c, d;                                         
                                                               
       a = 15;                                                 
       b = 10;                                                 
       c = ++a - b;                                            
                                                               
       printf("a = %d  b = %d  c = %d\n",a, b, c);             
                                                               
       d = b++ +a;                                             
                                                               printf("a = %d  b = %d  d = %d\n",a, b, d);  
            
printf("a/b = %d\n", a/b);                              
printf("a%%b = %d\n", a%b);                             
printf("a *= b = %d\n", a*=b);                          
printf("%d\n", (c>d) ? 1 : 0);                        
printf("%d\n", (c<d) ? 1 : 0);                          
   }                                                           
                                                               
                                                               
Output                                                      
                                                               
   a = 16  b = 10  c = 6                                       
   a = 16  b = 11  d = 26                                      
   a/b = 1                                                     
   a%b = 5                                                     
   a *= b = 176                                                
   0                                                           
   1                                                           
  
Share: 


Didn't find what you were looking for? Find more on Program that illustrates arithmetic operators Or get search suggestion and latest updates.

Ludvig Fischer
Ludvig Fischer author of Program that illustrates arithmetic operators is from Frankfurt, Germany.
 
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!