maximum of two numbers program in c code example

Example: c program for the largest of two numbers

/*Program for adding two numbers*/
#include <stdio.h>
int main(){
	int a, b;
    printf("Enter the first number: \n"); //Prompts user to enter the first number.
    scanf("%d", &a);//Accepts input and saves it to variable a
    printf("Enter the second number: \n");
    scanf("%d", &b);//Accepts input and saves it to variable a
    if (a > b){
    	printf("%d is greater than %d", a, b);
        }
    else
    	printf("%d is greater than %d", b, a);
}

Tags:

C Example