Pages

Adsense responsive

Wednesday, 20 February 2013

C PROGRAM: TO FIND ARITHMETIC MEAN OF THREE NUMBERS USING POINTER

CODING:
#include<stdio.h>
#include<conio.h>
void main()
{
 int num1,num2,num3,*p1,*p2,*p3;
 float am;
 clrscr();
 p1=&num1;
 p2=&num2;
 p3=&num3;
 printf("Enter 1st no. ");
 scanf("%d",p1);
 printf("Enter 2nd no. ");
 scanf("%d",p2);
 printf("Enter 3rd no. ");
 scanf("%d",p3);
 am=(*p1+*p2+*p3)/3.0;
 printf("Arithmetic mean: %f",am);
 getch();
}


CODING

OUTPUT

For any query or suggestion please comment below...

No comments:

Post a Comment