Chapter 6:
Looping Structures
Programming Exercise
Problem # 4:
Write a program to display alphabets from A to Z using for loop.
Solution:
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
for(char ch='A';ch<='Z';ch++)
cout<<ch<<endl;
return 0;
}
#include<conio.h>
using namespace std;
int main()
{
for(char ch='A';ch<='Z';ch++)
cout<<ch<<endl;
return 0;
}
Let me know in the comment section if you have any question.
Previous Post:
3. Program that displays the sum of the following series using do-while loop. 1 + 1/4 + 1/8 + ... + 1/100
Comments
Post a Comment