Untitled

mail@pastecode.io avatar
unknown
c_cpp
3 years ago
541 B
7
Indexable
Never
#include <stdio.h>
#include <math.h>
int main(){
    int num1,num2;
        printf("Enter number 1:");
        
        while (scanf("%d", &num1) != 1) {
            while (getchar() != '\n'); 
        }
        printf("Enter number 2:");
        while (scanf("%d", &num2) != 1) {
            while (getchar() != '\n'); 
        }
    while(num1<=0||num2<=0){
      printf("Enter Two numbers:");
      scanf("%d %d", &num1, &num2);
      
    }
    printf("Geometric mean = %.2f\n",sqrt(num1*num2));
    return 0;
}