answersLogoWhite

0


Best Answer

#include<stdio.h>

#include<conio.h>

void main()

{

int a,b,c;

float avrg;

printf("enter the first number:");

scanf("%d",&a);

printf("enter the second number:");

scanf("%d",&b);

printf("enter the third number:");

scanf("%d",&c);

avrg=(a+b+c)/3.0;

printf("The average of given numbers is:%f",&f);

getch();

}

this c program is specifically for three variables only.

User Avatar

Wiki User

βˆ™ 13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

βˆ™ 15y ago

#include <stdio.h> #include <stddef.h>

int main() { int a,b,c; printf("Enter three numbers"); if( scanf("%d %d %d",&a,&b,&c) == 3 ) { a += b + c;

printf("The sum is %d",a);

} else { printf("Invalid input!\n" Bye!\n\n"); exit(EXIT_FAILURE); } return EXIT_SUCCESS;

}

This answer is:
User Avatar

User Avatar

Wiki User

βˆ™ 16y ago

main ()

{

/* create memory spaces for variables */

int integer_one, integer_two, integer_three, integer_sum;

/* initialize variables */

integer_one = 5; integer_two = 7; integer_three = 8;

/* Sum the variables */

integer_sum = integer_one + integer_two + integer_three;

/* print the variables */

printf ("answer is %d", integer_sum);

}

---------------------------------------------------------

- Anything with /* or */ is a comment

- This 'program' allows for no input, just output. To get it interactive you'd have to use getc to get the keystrokes then add them.

This answer is:
User Avatar

User Avatar

Wiki User

βˆ™ 14y ago

#include<stdio.h>

#include<conio.h>

// Declaration of function

float add(float,float,float);

//definition of function

float add(float a,float b, float c)

{

float x;

x=a+b+c;

return x;

}

// main function

void main()

{

float a,b,c,x;

printf("Enter three numbers");

scanf("%f,%f,%f",&a,&b,&c);

x=add(a,b,c);

printf("The addition is %f",x);

getch();

}

This answer is:
User Avatar

User Avatar

Wiki User

βˆ™ 11y ago

The same way you do it in any language: divide the sum by three.

int x, y, z, average;

x = 1;

y = 3;

z = 5;

average = (x+y+z)/3;


This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program to find the average of three numbers using c language?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you write an assembly language program to find the sum of n numbers using array?

write an assembly language program to find sum of N numbers


How do you write the average n numbers program in c language?

Write your program and if you are having a problem post it here with a description of the problem you are having. What you are asking is for someone to do your homework for you. no i am asking to verify my answer


Write an assembly language program to multiply two BCD numbers?

fish


Could you Write a program for 8086 microprocessor that displays on the monitor the average of 2 numbers from an array?

How to write a program for mouse in microprocessor?


How can you write a program to find the mean resistance in c language given the values of 8 resistances?

"Mean" usually means "average", so you just add the numbers together, then divide by 8.


Write a programme for substraction of two numbers in c language?

substracion of any two number program in c


Write a program in C language to multiply any two numbers without using in source code?

The question is malformed and incomprehensible.


Write Client and server program in C language using UDP?

Write and run a client and a server program in C-language using UDP


How do you Write a program in 'c' language which accepts int numbers from the users print its reverse number x function which return value?

question clarity


Write an assembly language program to print a to z on screen?

write a program to print A to Z on screen in c?


Can you write program by c language in dos?

Yes.


Write a program in Lex to eliminate white space and collect numbers as a token?

write a lex program to delete space from the program