Featured post

-Write C program to find even and odd number using macro

-Write C program to find even and odd number using macro #include<stdio.h> #define number(n)((n%2==0)?1:0) int main() { int num; printf("enter any number"); scanf("%d",&num); if(number(num)) printf("number is even"); else printf("number is odd"); return 0; } ***************************Output*********************** amr@amrj-virtual-machine:~$ gccevenodd.c amr@samr-virtual-machine:~$ ./a.out enter any number 2 number is evensmj@amr-virtual-machine:~$

Write a C progrming To Calculate & Print Arithmetic Mean and Harmonic Mean.


 Write a C progrming  To Calculate & Print Arithmetic Mean and Harmonic Mean.



#include<stdio.h>
void main()
{
floata,b;
floatam,hm;
printf("Enter the value of a");
scanf("%f",&a);
printf("Enter the value of b");
scanf("%f",&b);
am=(a+b)/2;
printf("arithmetic mean=%f",am);
hm=2/(1/a+1/b);
printf("\n");
printf("harmonic mean=%f",hm);
printf("\n");
}

OUTPUT :-
Amr@Amr-virtual-machine:~$ gcc slip1a.c
Amr@Amr-virtual-machine:~$ ./a.out
Enter the value of a 120
Enter the value of b 20
arithmeticmean= 70.0000
harmonic mean= 34.285713


Comments

Popular posts from this blog

How to OCR Text Extraction in Flutter Using Google ML Kit

Stack in Data structure

BCA (SCIENCE) JAVA PRACTICAL SLIPS PAGES.(JAVA) UNIVERSITY OF PUNE