Search This Blog

Thursday, October 13, 2011

Write a program to read two num and evaluate and display their sum using a function


   1:  #include<stdio.h>
   2:  #include<conio.h>
   3:  float getsum(float a,float b);
   4:  void main()
   5:  {
   6:  float x,y;
   7:  float sumxy;
   8:  printf("Enter the two num:\n");
   9:  scanf("%f%f",&x,&y);
  10:  sumxy=getsum(x,y);
  11:  printf("The sum of %f and %f is: %f",x,y,sumxy);
  12:  getch();
  13:  }
  14:  float getsum(float a,float b)
  15:  {
  16:  float sum;
  17:  sum=a+b;
  18:  return(sum);
  19:  }

No comments:

Post a Comment