Pangrams are sentences constructed by using every letter of the alphabet at least once.
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main() {
int count=0;
int c,i,a[27]={0};char b[1000];
scanf("%[ !-z]266s",b);
// printf("%s",b);
/* for(i=0;i<strlen(b);i++)
{
printf("%c ",b[i]);
}printf("\n");
*/
for(i=0;i<strlen(b);i++)
{
a[26]=b[i];//printf("%c ",a[26]);
if(a[26]>=65&&a[26]<=90)
{ c=(a[26]-64)-1;
if(a[c]!=1)
{
a[c]=1;//printf("\ni is %d \n",i);
++count;
}
}
if(a[26]>=97&&a[26]<=122)
{ c=(a[26]-96)-1;
if(a[c]!=1)
{
a[c]=1;
++count;
}
}
if(count==26)
{
printf("pangram");
goto bottom;
}
}
printf("not pangram");
bottom:
// printf("%d",count);
return 0;
}
Visit : https://c-programs-world.blogspot.in for more question
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main() {
int count=0;
int c,i,a[27]={0};char b[1000];
scanf("%[ !-z]266s",b);
// printf("%s",b);
/* for(i=0;i<strlen(b);i++)
{
printf("%c ",b[i]);
}printf("\n");
*/
for(i=0;i<strlen(b);i++)
{
a[26]=b[i];//printf("%c ",a[26]);
if(a[26]>=65&&a[26]<=90)
{ c=(a[26]-64)-1;
if(a[c]!=1)
{
a[c]=1;//printf("\ni is %d \n",i);
++count;
}
}
if(a[26]>=97&&a[26]<=122)
{ c=(a[26]-96)-1;
if(a[c]!=1)
{
a[c]=1;
++count;
}
}
if(count==26)
{
printf("pangram");
goto bottom;
}
}
printf("not pangram");
bottom:
// printf("%d",count);
return 0;
}
Visit : https://c-programs-world.blogspot.in for more question
0 comments:
Post a Comment