Tuesday, March 1, 2016

Finding x and y in equations using C program

1:  #include <stdio.h>  
2:    
3:  int main()  
4:  {  
5:      double x,y,x_plus_y,x_minus_y;  
6:        
7:      printf("Enter the value of x+y:");  
8:      scanf("%lf",&x_plus_y);  
9:        
10:      printf("Enter the value of x-y:");  
11:      scanf("%lf",&x_minus_y);  
12:        
13:      x=(x_plus_y+x_minus_y)/2;  
14:      y=(x_plus_y-x_minus_y)/2;  
15:        
16:      printf("x= %.2lf \t y= %.2lf ",x,y);  
17:        
18:      return(0);  
19:        
20:        
21:  }   

No comments:

Post a Comment

Thank you for commenting. Please wait for response :)