C program for count any characters which is u want, C/C++ Programming

Assignment Help:

 

# include stdio.h>

# include string.h>

# include conio.h>

void main()

 

{

          int i=0,count=0;

          char a[100],b;

          clrscr();

          for(i=0;i<100;i++)

          {

                   a[i]=0;

          }

          i=0;

          printf("\nENTER THE STRING: ");

          gets(a);

          printf("ENTER THE CHARACTER U WANT TO COUNT; ");

          scanf("%c",&b);

          for(i=0;a[i]!='\0';i++)

          {

                   if(a[i]==b)

                   {

                             count++;

                   }

          }

          printf("\nTHE CHARACTER IS %c",b);

          printf("\nTHE TOTAL OF ABOVE CHARACTER IS %d",count);

          getch();

}

OUTPUT :

ENTER THE STRING: KAMLESH D MENGAR

ENTER THE CHARACTER WHICH U WANT TO COUNT: A

 THE CHARACTER IS A

THE TOTAL OF ABOVE CHARACTER IS 2


Related Discussions:- C program for count any characters which is u want

Implementation of the stack class in c++, Implementation of the Stack class...

Implementation of the Stack class in C++: How to implement stack class in c++. int Stack::push(int elem) {    if (top    {       list[top++] = elem;       r

Command-line arguments, Command-line arguments are passed into programs usi...

Command-line arguments are passed into programs using the arguments of main(). Here's a quick example, for a program called by typing "progname file.txt 1 2.7": #include #incl

Matrix transposition cipher, write a C rpogram that can display the transpo...

write a C rpogram that can display the transpose form of a ciphertext matrix.Prompt users to provide row and coloumn number of matrix.Then user will input plaintext and the program

Padovan string , .write a program that counts the number of occurrences of ...

.write a program that counts the number of occurrences of the string in the n-th padovan string p(n)   program in java // aakash , suraj , prem sasi kumar kamaraj college

Charity Ball Organizer, Charity Ball Organizer Many charities support good...

Charity Ball Organizer Many charities support good causes, but one of the difficulties each of them has is organizing their fundraising events. After nearly a semester of C progra

Area under the curve, program area under the curve y=f(x) between x=a & y=b...

program area under the curve y=f(x) between x=a & y=b, integrate y=f(x) between the limits of a & b   Solution: #include float    start_point,            /* GLOBAL V

Calculate the discharge by c program, #include stdio.h #include math.h ...

#include stdio.h #include math.h float discharge(float,float); void main()   {   char prompt;      float time,out,cr;   cr = 100e-6;   for (time = 0;time   {   /* call th

Explain mixed mode expressions and implicit type conversions, Mixed Mode Ex...

Mixed Mode Expressions and Implicit type Conversions A mixed mode expression is one in which the operands are not of the similar type. In this case, the operands are converted

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd