Sign in to follow this  
Cornel Iulian

[C] Maximul dintre 3 numere intregi

1 post in this topic

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

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

int main(void)
{
	int a,b,c,max;
	printf("Introduceti 3 numere intregi:\n");
	if(scanf("%d%d%d",&a,&b,&c)!=3)
	{
		printf("Date eronate");
		exit(1);
	}
	if(a>b)
		max=a;
	else
		max=b;
	if(max<c)
		max=c;
	
	printf("Maximul dintre %d,%d,%d este: %d",a,b,c,max);
		
	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