Sign in to follow this  
Cornel Iulian

[C] Media aritmetica dintre 3 numere intregi

1 post in this topic

Cerinta: Sa se scrie un program C care determina media aritmetica dintre 3 numere intregi.

#include <stdio.h>
#include <stdlib.h>

int main(void)
{
	int a,b,c;
	double ma;
	printf("Introduceti 3 numere intregi:\n");
	if(scanf("%d%d%d",&a,&b,&c)!=3)
	{
		printf("Date eronate");
		exit(1);
	}
	ma=(a+b+c)/3;
	
	printf("Media aritmetica este: %g",ma);		
	return 0;
}

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this