//to calculate using while
#include<stdio.h>
#include<conio.h>
void main()
{ int count
float average,sum;
sum=0;
count=0;
while(count<N)
scanf("%f",n)
sum=sum+count
count=count+1
}
average=sum/n
#include<iostream>
#include<sstream>
#include<vector>
#include<numeric> // for std::accumulate()
// If the given string represents a natural number then return its value.
// Otherwise return 0 to indicate error (note: 0 is not a natural number).
unsigned string_to_natural (const std::string& str) {
if (str.empty() str.find_first_not_of("0123456789")!=str.npos) return 0;
std::stringstream ss;
ss<<str;
unsigned u;
if (ss>>u)
return u;
return 0;
}
int main (void) {
std::vector<unsigned> ages;
while (true) {
std::cout<<"Input age (100 to end): ";
std::string input;
std::cin.clear();
std::cin>>input;
unsigned age {string_to_natural (input)};
if (age==100) break;
if (age==0) {
std::cerr<<"Invalid input.\n";
continue;
}
ages.push_back (age);
}
std::cout<<"Average age: "<<std::accumulate (ages.begin(), ages.end(), 0)/ages.size()<<std::endl;
}
#include
#include
void main()
{
int a,b,c,d,e,total,name,rollno,i;
float avg;
clrscr();
i=1;
while(i
write a c++ program to convert binary number to decimal number by using while statement
A = 5do{statement;A = A + 1;} while (A < 10)
Using while loop, write a program which calculates the product of digits from 1 to 5 and also show these no's vertically.
function factorial(n) { var x=1; while(n>1) x*=(n--); return x; }
by this program you can find the factorial: #include<iostream> using namespace std; main() { int n,x,f=1; cin>> n; x=0; while(x<n) { x++; f= f*x; } cout<<"factorial is"<<f<<"\n"; system("pause"); return 0; }
The following cases are all possible:- program without any for and while- program without for- program without while- program with both for and while
write a c++ program to convert binary number to decimal number by using while statement
In the RAM
Not used
eleporo
A = 5do{statement;A = A + 1;} while (A < 10)
int i=0; while (i++<n) { /*...*/ }
Using while loop, write a program which calculates the product of digits from 1 to 5 and also show these no's vertically.
The Google word processor is one component of the Google Documents program. This program can be found on the Google website. The program gets average reviews and is recommended for people who only use word processing once in a while.
Skype headsets are hands-free devices that allow you to hear and talk into a microphone while using the Skype program. They are used to make the Skype users experience easier while doing other things and using the Skype program.
While jerking it, take 2 and divide it by the mass.
function factorial(n) { var x=1; while(n>1) x*=(n--); return x; }