Skip to content

Instantly share code, notes, and snippets.

@sachinsaxena25
Last active August 1, 2019 16:02
Show Gist options
  • Save sachinsaxena25/8f8fc21b348d9f9af1fcc5d56af2bc4c to your computer and use it in GitHub Desktop.
Save sachinsaxena25/8f8fc21b348d9f9af1fcc5d56af2bc4c to your computer and use it in GitHub Desktop.
#include<stdio.h>
int main(void){
int a = 0;
float b = 0.0f;
double c = 0.0;
long double d = 0.0;
printf("please enter the first number:\n");
scanf("%d", &a);
printf("please enter the second number:\n");
scanf("%f", &b);
printf("please enter the third number:\n");
scanf("%lf", &c);
d = (a + b + c) / 3;
printf("Avarage of Number:%.2Lf", d);
return 0;
}
@dbc2201
Copy link

dbc2201 commented Aug 1, 2019

#include<stdio.h>
int main(void){
	float a = 0.0f;
	float b = 0.0f;
	float c = 0.0f;
	float d = 0.0f;
	printf("please enter the first number:\n");
	scanf("%f", &a);
	printf("please enter the second number:\n");
	scanf("%f", &b);
	printf("please enter the third number:\n");
	scanf("%f", &c);
	d = (a + b + c) / 3.0f; // all the numbers should be in the same format
	printf("Avarage of Number:%.2f", d);
	return 0;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment