Thursday, 8 January 2015

C Program To Calculate Average of Two Numbers

/* Average of two number in c */

For any query regarding c/c++ feel free to contact me on khimanichirag@gmail.com or comment below. I try my best to solve it.

 #include<stdio.h>  
 #include<conio.h>  
 void main()  
 {  
      int n1,n2;  
      float avg=0.0;  
      clrscr();  
      printf("Enter the first number: ");  
      scanf("%d",&n1);  
      printf("\nEnter the second number");  
      scanf("%d",n2);  
      avg=(n1+n2)/2;  
      printf("\nThe average of two number is: %f",avg);  
      getch();  
 }  

No comments:

Post a Comment