Wednesday, July 12, 2017

do-while loop in C++

C++ program to print Z to A using do..while loop.

#include<iostream> 
using namespace std;
int main()
{
  char ch='Z';
  do
  {
    cout << ch;
  ch = ch - 1;
  }
  while(ch >= 'A');
  return 0;
}

Output of program

ZYXWVUTSRQPONMLKJIHGFEDCBA

No comments:

Post a Comment