While Loop in C++


SUBMITTED BY: Nrupeshsinh

DATE: June 24, 2016, 8:22 a.m.

FORMAT: Text only

SIZE: 437 Bytes

HITS: 510

  1. #include<iostream>
  2. #include<conio.h>
  3. using namespace std;
  4. int main()
  5. {
  6. // Variable Declaration
  7. int a;
  8. // Get Input Value
  9. cout<<"Enter the Number :";
  10. cin>>a;
  11. int counter = 1;
  12. //while Loop Block
  13. while (counter <= a)
  14. {
  15. cout<<"Execute While "<<counter<<" time"<<endl;
  16. counter++;
  17. }
  18. // Wait For Output Screen
  19. getch();
  20. return 0;
  21. }

comments powered by Disqus