Tuesday, March 1, 2016

Adding two numbers using user define function in C

1:  #include<stdio.h>  
2:    
3:  int sum(int a, int b){  
4:      int add;  
5:      add= a+b;  
6:        
7:      return add;  
8:        
9:  }  
10:    
11:  main()  
12:  {  
13:      int x,y;  
14:      while(1){  
15:            
16:          scanf("%d %d",&x,&y);  
17:      int jog;  
18:      jog = sum(x,y);  
19:        
20:      printf("%d\n",jog);  
21:        
22:      }  
23:  }  

No comments:

Post a Comment

Thank you for commenting. Please wait for response :)