+ 1
Why is k always 0
#include <stdio.h> #include <string.h> main() { char ch1,p[30]; int k,i,j; printf("please enter a string") gets(p) printf("please enter a letter") scanf("%s",&ch1); for(i=0;i<strlen(p);i++) if(p[i]==ch1) k++; printf("num count is %d,k") }
5 Antworten
+ 5
You have many mistakes like semi-colon missing, wrongly printed k and also we should not use gets in modern compiler.
https://code.sololearn.com/cErQryHvbV2D/?ref=app
+ 3
Thanks ❤
+ 2
Mehmet_Hamdi
Sololearn doens't support Swing.
+ 1
https://code.sololearn.com/cV1x96E3zraT/?ref=app
Simple help...the code is working on the laptop, but it shows an error on the site!!!!
+ 1
Thanks