Medical Factors Which make it The most effective just by Sejal Kakadiya Medicine and health agencies with now consentrate on top quality, charge together with great satisfaction health of their solutions. These are typically that support beams which a lot of these agencies redefine the direction they trade. The following really results in thrilled clients. How come Serious Treatment Direction Can be a Trend Inside Medicine and health Sector just by Steven Orange A whole lot of North american healthcare systems' options are generally about that direction together with procedure with serious circumstances. Direction with serious health conditions which include diabetes, excessive circulation demand, cardiovascular disease, together with hypothyroidism can be a vital component of easiest treatment healthcare provider's succeed. Inside standard product, that general practitioner spots someone on an automobile accident with treatment, inspects that condition ...
In this program sum and average of of the given numbers are calculated using do-while loop.
Do-while loop is a looping condition where statements are executed continuously until the condition validates and test the condition after having executed the statements within the loop.
This means that do-while would execute its statements at least once, even if the condition fails for the first time.
Scanf() command is used here to allow enter the numbers and sum=sum+num; to sum the numbers within do-while loop.
C Program to Find the Sum and Average of Numbers Using Do-While Loop
Steps:
- Declare two integers i and n and also initialize i with 0.
- Declare three floats sum, avg and num and initialize sum with 0.
- Print the message on the screen to enter how many numbers want to find sum.
- Use do-while loop to insert the numbers calculate the sum and average.
Code:
#include<stdio.h>
#include<conio.h>
void main()
{
int i=0,n;
float sum, avg, num;
clrscr();
sum=0;
printf("How many numbers you want to find sum and average\n");
scanf("%d",&n);
printf("Enter the numbers\n");
do{
scanf("%f", &num);
sum=sum+num;
i++;
}
while (i<n);
avg=sum/n;
printf("Sum=%f\n", sum);
printf("Average=%f\n", avg);
getch();
}
Related Posts:
- Write a Program in C to Copy a String to Another.
- Write a Program in C to Sort a List of Numbers in Ascending Order
- Write a Program in C to Calculate the Factorial Value of an Integer.
- Write a Program in C to Determine Whether a Number is Prime or Not.
- C Program to Read Set of Real Numbers from Keyboard & Find the Maximum
- How to Create a Digital Clock in JavaScript?
- How to Detect Visitor's Browser Using JavaScript?
- How to Create JavaScript Image Slideshow with Links
- Simple JavaScript Fade Effect Animation Using Jquery
- How to Create Simple JavaScript Fade Effect Animation?
- How to Create Pop Up Menus in Oracle Forms ?
- How to Create LOV in Oracle Forms Using Wizard ?
Comments
Post a Comment