Question Bank (5 marks) · Q13
Q.Write a C program to accept three integers and print the largest amongst them.
Karnataka PUCTextbookLong· 5mImportance★★★★★est
44% · 68/154 Questions
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →[!TLDR]
Read three integers, assume the first is largest, then compare with the other two to find and print the greatest.
The largest of three integers is found by taking the first as the assumed largest and then comparing it with the remaining two using the > operator, updating the largest whenever a bigger value is found.
#include <stdio.h>
int main()
{
int a, b, c, large;
printf("Enter three integers: ");
scanf("%d %d %d", &a, &b, &c);
large = a;
if (b > large)
large = b;
if (c > large)
large = c; …
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.