Program to print all alphabets from A to Z using loop

Problem statement:- Program to print all alphabets from A to Z using a loop.

Data requirement:-

   Input Data:- i

  Output Data:-i

Program in C

Here is the source code of the C Program to print all alphabets from A to Z using a loop.

Code:

#include<stdio.h>
#include<stdio.h>
int main()
{
    int i=0;
    printf("Printing A-Z using ASCII\n");
    for(i=65;i<=90;i++)
        printf("%c ",i);
}

Input/Output:
Printing A-Z using ASCII
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Program in C++

Here is the source code of the C++ Program to print all alphabets from A to Z using a loop.

Code:

#include<iostream>
using namespace std;
int main()
{
    cout<<"Printing a-z using ASCII\n";
    for(int i=65;i<=90;i++)
        cout<<char(i)<<" ";
}

Input/Output:
Printing A-Z using ASCII
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Program in Java

Here is the source code of the Java Program to print all alphabets from A to Z using a loop.

Code:

public class printatozsmall {

public static void main(String[] args) {

System.out.println("Printing A-Z using ASCII\n");
    for(int i=65;i<=90;i++)
        System.out.print((char)i+" ");
}}

Input/Output:
Printing A-Z using ASCII
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Program in Python

Here is the source code of the Python Program to print all alphabets from A to Z using a loop.

Code:

print("Printing A-Z using ASCII")
for i in range(65,90+1):
    print(chr(i),end=" ")

Input/Output:
Printing A-Z using ASCII
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Post a Comment

0 Comments