C program to find the largest among three numbers



This is the C Program to find the largest among three numbers The program first declares four integer variables – num1, num2, num3 and largest.

  • It then prompts the user to enter three numbers using the printf and scanf functions.
  • Using the if-else statements, the program compares the three numbers to determine the largest number among them.
  • Finally, the program uses the printf function to output the largest number to the user.
#include <studio.h>

int main() {
int num1, num2, num3, largest;
printf("Enter three numbers: ");
scanf("%d %d %d", &num1, &num2, &num3);

if (num1 >= num2 && num1 >= num3)
    largest = num1;
else if (num2 >= num1 && num2 >= num3)
    largest = num2;
else
    largest = num3;

printf("Largest number is %d", largest);

return 0;
}

output

Enter three numbers: 10 15 20
Largest number is 20

C program to find the largest among three numbers
C program to find the largest among three numbers
output of C program to find the largest among three numbers
output of C program
admin https://study-from-here.com

Digital Marketing Consultants and Social Media Marketing Expert with over 3 years of rich experience in various Branding, Promotions, business directories, On pages and off page optimization, Link building Advertising, Research, paid advertisement, content writing and marketing

You May Also Like

More From Author

12Comments

Add yours
  1. 4
    Warung138

    Hi there very cool blog!! Man .. Beautiful .. Superb .. I will bookmark your website and take the feeds additionally?KI am happy to seek out so many useful info here within the post, we’d like develop extra strategies in this regard, thanks for sharing. . . . . .

  2. 5
    Warung138

    I was just seeking this info for some time. After six hours of continuous Googleing, at last I got it in your website. I wonder what is the lack of Google strategy that do not rank this kind of informative web sites in top of the list. Usually the top web sites are full of garbage.

  3. 9
    KKSLOT777

    You could certainly see your enthusiasm within the work you write. The arena hopes for more passionate writers such as you who are not afraid to say how they believe. All the time follow your heart. “There are only two industries that refer to their customers as users.” by Edward Tufte.

  4. 10
    KKSLOT777

    My spouse and I absolutely love your blog and find many of your post’s to be just what I’m looking for. Does one offer guest writers to write content for yourself? I wouldn’t mind creating a post or elaborating on most of the subjects you write with regards to here. Again, awesome website!

+ Leave a Comment