answersLogoWhite

0


Best Answer

printf ("%g\n", (n+1.0)/2);

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the program to calculate the average of first 'n' natural numbers?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Math & Arithmetic

An example of a PASCAL program to find the average of a set of numbers?

how to get the arithmetic average on pascal


How can you form a program of finding the average of five numbers?

to find the average (a.k.a mean) of any set of numbers you add all of the numbers up, then divide by however many numbers there are. for ex: 2,7,5,9,4 1st step: 2+7+5+9+2= 25 2nd step: 25 divided by 5= 5 average equals=5


HOW TO SOLVE 'C' problem?

1. write a 'c' program to read 4(four)numbers from a file 'BANK' and calculate the average of the numbers.Now print the calculated average in another output file 'AVERAGE' 2. write a 'c' program that finds the sum and average of inputted five integer numbers of the array using dynamic memory allocation function malloc(). 3. write a 'c' program to create simple elements 1,2,3,4 in the link list of 4(four)nodes and display the list's elements. 4. write a 'c' program to convert the expression (A+B)/(C+D) into postfix expression into stack.and then evaluate it for A=10,B=20,C=15,D=5 and display the stack status after each operation. 5. write a 'c' programto create a linked list implemented on an array containing the following numbers:1,2,3,3,3,4,4,9 and pack it to remove the duplicate numbers.so that only the following data are contained by the nodes:1,2,3,4,9


Write a FORTRAN program using if statement to calculate the smallest of three numbers xyz?

N = x If y < N then N = Y If z < N then N = z Print N


C program to calculate sum and average of 4 numbers?

/*mycfiles.wordpress.com To Calculate Sum & Average of 4 no.*/ #include<stdio.h> #include<conio.h> void main() { float a,b,c,d,sum,avg; clrscr(); printf("Enter the 4 nos.\n\n"); scanf("%f%f%f%f",&a,&b,&c,&d); sum=a+b+c+d; avg=(a+b+c+d)/4; printf("\nSum is= %f\nAverage is= %f",sum,avg); getch(); }

Related questions

Program to calculate the sum of first ten natural numbers?

Algorithm to find the sum of first n natural numbers:1. Read n.2. Initialize N=1.3. Initialize sum S=0.4. Calculate S=S+N.5. Calculate N=N+1.6. If N>n, then goto step 7 else goto step 4.7. Write the sum S.8. Stop.


An example of a PASCAL program to find the average of a set of numbers?

how to get the arithmetic average on pascal


Write a java script program to print first ten odd natural numbers in C?

Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.


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?


What is c program to calculate product of all even numbers from entered number down to 1?

c is programming laungage


C plus plus program calculate the power value of input base and exponent numbers?

cn = c0 *( 1 + i ) pow n


Write the program in qbasic and add two numbers?

Cls input "enter two no.s ",a,b sum=a+b print "sum = ";sum end


Unix script to calculate average of n numbers given by user?

You really don't want to do this in a shell script - scripting languages in Unix typically do not handle or work with floating values, only integers. A better way would be to write a program to do this that works under Unix, such as a 'C" program. See the related link for an example


How do you write a program to find out the square and cube of first ten natural numbers in gw basic?

First you will need to have some basic programming knowledge. You can use this to help make the program that is needed.


How can you form a program of finding the average of five numbers?

to find the average (a.k.a mean) of any set of numbers you add all of the numbers up, then divide by however many numbers there are. for ex: 2,7,5,9,4 1st step: 2+7+5+9+2= 25 2nd step: 25 divided by 5= 5 average equals=5


What is the relationshjip between a computer program and an algorithm?

A computer program can use a pre-programmed Algorith to calculate what you want it to calculate.


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