Home Basic Loop Array string Function Pointer Contact STUDY

AHF    C    PROGRAM    SOLVING

Programming tips

Test expression



Header file



" ; " after loop



Comment



Iterative statement




String_ find any character with position




// AHF C PROGRAM SOLVING

//solving here 2_D   ARRAY 	programming problem

#include #include #define pf printf int main() { char str[100],ch; int i,f,length=0; pf("\nEnter a string:"); gets(str); //counting given string length length=strlen(str); pf("\nenter a character to find its position: "); scanf("%c",&ch); //searching given character from given string for(i=0;i < length;i++) { if(str[i]==ch) //checking the character { pf("\nThe position of searching character is : %d",i); f=1; } } //if character is not found if(f==0) { pf("\nCharacter is not found"); } return 0; }
OUTPUT:


© 2018 - All rights reserved