www.cprogramming.tk

www.cprogramming.tk

Program get number from user and terminate if user enter -1.

A program that use while loop and get numbers from user,tha program terminate/quit program when user enter -1.



using namespace std;
#include<iostream>
#include<conio.h>
int main()
{
int n;
n=1;
while(n!=-1)
{
cout<<"Enter a number:";
cin>>n;
cout<<"You entered:"<<n<<endl;
}
cout<<"End of Program";

getch();
return 0;
}
Program get number from user and terminate if user enter -1. Program get number from user and terminate if user enter -1. Reviewed by Shoaib Jameel on 3/18/2017 04:52:00 pm Rating: 5

No comments:

Theme images by mariusFM77. Powered by Blogger.