- #include<stdio.h>
- #include<conio.h>
- void main()
- {
- char s[30];
- int i,n,x;
- printf("enter the string:");
- scanf("%s",s);
- x=strlen(s);
- printf("enter the position of a char to be find:");
- scanf("%d",&n);
- if(n<x)
- {
- for(i=0;s[i]!='\0';i++)
- {
- if(n==i)
- printf("the char at this position is:%c",s[i]);
- }
- }
- else
- printf("the char is not present");
- }
- }
- else
- printf("the char is not present");
- }