write a program to count number of occurrences of a character in a given string in C language
write a program to count number of occurrences of a character in a given string in C
**My KZitem Channel::::::::
/ @codecafe20
**My Instagram Account:::::::
instagram.com/...
****************************************""""""***
**Explanation:::::
•This program takes a string as input from the user using the gets() function, and a character to count using the scanf() function. It then iterates over the string using a while loop, counting the number of occurrences of the character using an if statement.
• Finally, it prints the number of occurrences to the console using the printf() function.
•The program works by first declaring a character array str with a maximum size of 50 and a character variable ch.
•It then initializes the count variable to zero and declares an integer variable i to be used as a loop counter.
•The program then prompts the user to enter a string using the printf() function, and reads in the input using the gets() function.
•Similarly, the program prompts the user to enter a character to count using the printf() function and reads in the input using the scanf() function.
*************************************************
**Your Queries::::::
c programming
string in c
c programming language
strings in c
c programming for beginners
c programming tutorial
learn c programming
c programming basics
c programming course
c language
c language tutorial for beginners
learn c language
c language demo
c language overview
c tutorial
c tutorial for beginners
edureka c programming
**Hashtag:::::::
#c
#clanguage
#code
#coding
#viral
#viralshorts
#short
#shortsvideo
#viralvideo
#shorts
#clanguage
#sumofseries
#100
#how
#cprogramminglanguagebeginners
#cprogramming
#viralshort
Негізгі бет write a program to count number of occurrences of a character in a given string in C language
Пікірлер