Program 3: Accept 2 numbers and print arithmetic and harmonic mean. #include<stdio.h> void main() {      int a,b;      f...

C Program to find arithmetic and harmonic mean.



Program 3: Accept 2 numbers and print arithmetic and harmonic mean.
#include<stdio.h>
void main()
{
    int a,b;
    float am,hm;
    printf("Enter the values of a&b:");
    scanf("%d%d",&a,&b);
    am=a+b/2;
    hm=a*b/a+b;
    printf("\nArithmatic mean=%f",am);
    printf("\nHarmonic mean=%f",hm);
}

 Output
[root@localhost Desktop]#  gcc am.c
[root@localhost Desktop]# ./a.out
Enter the values of a&b:56 98
Arithmatic mean=105.000000
Harmonic mean=196.000000 😃

0 coment�rios:

HTML5 CSS3 TUTORIAL FOR BEGINNERS