C Program to print alphabets .

 Hello everyone,

This program is used to print Alphabets  in C programming language .  

Question :

Write a program to print the alphabets in c .

Solution 

#include<stdio.h>
#include<conio.h>
void main()
{
int i;
clrscr();
 for(i=65;i<=90;i++)
 {
 printf("%c ",i);
 }
getch();
}

Output:






Question : write a program to print alphabets in uppercase or lowercase  according to the user input.   

Solution:

#include<stdio.h>
#include<conio.h>
void main()
{
int i;
char value;
clrscr();
printf("enter u for uppercase \n");
printf("enter l for lowercase ");
scanf("%c",&value);
if(value=='u'||value=='U')
{
 for(i=65;i<=90;i++)
 printf("%c ",i);
}
 else if(value=='l'||value=='L')
{
 for(i=97;i<=122;i++)
 printf("%c ",i);
 }
 getch();
}


Output:




Hope you enjoyed tuned in for more codes .








                                                           

Comments

Popular Posts