Programming Examples

C program to check whether the given string is pangram or not


Pangram :- If a string contains every letter of the English alphabet i.e all 26 alphabets then the string is known as Pangram.

For Example :-

String1 = The quick brown fox jumps over the lazy dog

So as we can see that the given strings contains all letters of English alphabet therefore the string is Pangram.

Solution

#include<stdio.h>
#include<conio.h>
void main()
{
	char str[100]="The quick brown fox jumps over the lazy dog";
	int i,value[26]={0},count=0;
	for(i=0;str[i]!='\0';i++)
	{
		if('a'<=str[i] && str[i]<='z')
		{
			count+=!value[str[i]-'a'];
			value[str[i]-'a']=1;
		}
		else if('A'<=str[i] && str[i]<='Z')
		{
			count+=!value[str[i]-'A'];
			value[str[i]-'A']=1;
		}
	}
	if(count==26)
	{
		printf("The String is a Pangram String.");
	}
	else
	{
		printf("The String is not a Pangram String.");
	}
	getch();
}
Output

The String is a Pangram String.

CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz