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

 

# 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

Posted Date: 9/10/2012 4:21:02 AM | Location : United States







Related Discussions:- C program for count any characters which is u want, Assignment Help, Ask Question on C program for count any characters which is u want, Get Answer, Expert's Help, C program for count any characters which is u want Discussions

Write discussion on C program for count any characters which is u want
Your posts are moderated
Related Questions

Write a ''C'' program to accept any 3 digit integer number from the keyboard and display the word equivalent representation of the given number.

i need a detailed c program to explain the parameters of bernoulli''s equation..

What is a hash function? Hash function: This is the method from the set 'K' of keys into the set 'L' of memory addresses.   H: K → L These are used to verify the address

programing code on board coloring in clanguage

My project is compiling but the equation entered is not working

Explain Register Variable Computers have internal registers, which are used to keep data temporarily, before any operation can be performed. Intermediate results of the calcula

Hey vrcoder I have got similar way but the game builder has sent me the game unfinished and left. I saw it on a link on line but they have wiped the old message with the link in it


Define Functions with arguments and no return values The calling function will read a data from the terminal and pass it on to called as function and this will work good as the