#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int i,flag=0,m;
char s[5][10]={"if","else","goto","continue","return"},st[10];
clrscr();
printf("\n
enter the string :");
gets(st);
for(i=0;i<5;i++)
{
m=strcmp(st,s[i]);
if(m==0)
flag=1;
}
if(flag==0)
printf("\n it is not a keyword");
else
printf("\n it is a
keyword");
getch();
}
OUTPUT
enter the string :return
it is a keyword
enter the string
:hello it is not a keyword
PROGRAM TO FIND WHETHER THE
STRING IS CONSTANT
OR NOT
#include<stdio.h>
#include<conio.h>
#include<ctype.h>
#include<string.h>
void main()
{
char str[10]; int len,a;
clrscr();
printf("\n
Input a string :");
gets(str);
len=strlen(str); a=0; while(a<len)
{
if(isdigit(str[a]))
{
}
else
{
}
}
a++;
printf(" It is not a Constant");
break;
if(a==len)
{
printf("
It is a Constant");
}
getch();
}
OUTPUT
Input a string :23
It is a Constant
Input a string :a_123
It is not a Constant
4 comments:
i want to make a program in c to find a header file in a given program .how can i do this.......
rehan
orey goba pagilipodi roy neku jagratha ga unduu
goba pagulidiii okay
mr.subhramanyam cotact me
Post a Comment