SET A
1. Write a program, which accepts a character from the user and checks if it is an alphabet, digit
or punctuation symbol. If it is an alphabet, check if it is uppercase or lowercase and then change
the case.
#include<stdio.h>
#include<conio.h>
void main()
{
char ch;
clrscr();
printf("\nEnter charcter:");
scanf("%c",&ch);
if(isalpha(ch))
{
printf("\n%c is alphabet",ch);
if(isupper(ch))
printf("\n %c is uppercase alphabet",ch);
else if(islower(ch))
printf("\n %c is lowercase aplhabet",ch);
}
else if(isdigit(ch))
printf("\n %c is digit",ch);
else if(ispunct(ch))
printf("\n %c is a punctuation ",ch);
getch();
}
/*
Enter charcter:4
4 is digit
Enter charcter:!
! is a punctuation
Enter charcter:D
D is alphabet
D is uppercase alphabet
1. Write a program, which accepts a character from the user and checks if it is an alphabet, digit
or punctuation symbol. If it is an alphabet, check if it is uppercase or lowercase and then change
the case.
#include<stdio.h>
#include<conio.h>
void main()
{
char ch;
clrscr();
printf("\nEnter charcter:");
scanf("%c",&ch);
if(isalpha(ch))
{
printf("\n%c is alphabet",ch);
if(isupper(ch))
printf("\n %c is uppercase alphabet",ch);
else if(islower(ch))
printf("\n %c is lowercase aplhabet",ch);
}
else if(isdigit(ch))
printf("\n %c is digit",ch);
else if(ispunct(ch))
printf("\n %c is a punctuation ",ch);
getch();
}
/*
Enter charcter:4
4 is digit
Enter charcter:!
! is a punctuation
Enter charcter:D
D is alphabet
D is uppercase alphabet