+ 2

How to write string program in java

2nd Feb 2018, 3:53 PM
Mamta Dabas
Mamta Dabas - avatar
2 Respostas
2nd Feb 2018, 4:04 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 2
C program to find frequency of characters in a string... #include <stdio.h> int main() { char str[1000], ch; int i, frequency = 0; printf("Enter a string: "); gets(str); printf("Enter a character to find the frequency: "); scanf("%c",&ch); for(i = 0; str[i] != '\0'; ++i) { if(ch == str[i]) ++frequency; } printf("Frequency of %c = %d", ch, frequency); return 0; } source: https://www.programiz.com/c-programming/examples/frequency-character
2nd Feb 2018, 4:02 PM
Akash papnai
Akash papnai - avatar