Skip to content
Question Bank (5 marks) · Q9

Q.Write a C program to accept three numbers and compute their sum and average. Find the sum and average of 3, 7 and 8.

Karnataka PUCTextbookLong· 5mImportance★★★★★est
31% · 48/154 Questions
🔒 Locked · start free trial →

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 numbers, add them for the sum, divide the sum by 3 for the average; for 3, 7, 8 the sum is 18 and the average is 6.00.

The three values are read into float variables so that the average can carry a fractional part; the sum is their total and the average is the sum divided by 3.

#include <stdio.h>
int main()
{
    float a, b, c, sum, avg;
    printf("Enter three numbers: ");
    scanf("%f %f %f", &a, &b, &c);
    sum = a + b + c;
    avg = sum / 3;
    printf("Sum = %.2f\n", sum);
    printf("Average = %.2f\n", avg); …

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.