Follow This Blog For more... 😊

Program to accept two numbers and print the largest among them.| Using C language| very Basic| C Program series 08|

👨‍💻Program to accept two numbers and print the largest among them.

Code:


    //Program to accept two numbers and print largest among them.

    #include<stdio.h>

    main()
    {
        printf("Program to accept two numbers and print largest among them.\n");
       
        int a,b;//for two variables.
       
        printf("Enter value of a:");
        scanf("%d",&a);
       
        printf("Enter value of b:");
        scanf("%d",&b);
       
        if(a>b)//condition to check a is greater than b.
        {
            //Execute this part, if the condition becomes true.
            printf("\na=%d is Larger than b=%d",a,b);
        }
        else
        {
            //Execute this part, if the condition becomes false.
            printf("\nb=%d is Larger than a=%d",b,a);
        }
    }

Output:




👉Click for more C Program series Questions.[Questions list]

Comments

Popular Posts