Sunday, June 14, 2020

print string till character in c

input:
manager
e
output:
manag 

For clear explanation of this program check  https://youtu.be/GQzWQzFts8k

solution:
int main()
{
char s[100],c;
scanf("%s\n%c",s,&c);
for(int i=0;i<strlen(s);i++){
    if(s[i]!=c){
        printf("%c",s[i])}
    else{
        break;}    
}
}


1 comment:

MFIB Comma Separated Integers

Fill in the blanks with code so that the program must accept three integers separated by a space and print them separated by a comma as the ...