Tuesday, March 1, 2016

Calculating (a+b)^2 in C

1:  #include <stdio.h>  
2:    
3:  int main()  
4:  {  
5:        
6:              int a,b,c;  
7:              printf("Enter the value of a and b :\t");  
8:              scanf("%d %d",&a,&b);  
9:              c=a+b;  
10:              printf("The value of (a+b)^2 is %d",c*c);  
11:        
12:      return 0;          
13:  }  

No comments:

Post a Comment

Thank you for commenting. Please wait for response :)