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
Define Scope Rules of C program - Computer Programming? The fundamental rule of scope is that identifiers are accessible only within the block in which they are declared and th

Object Conversions Just like initialization, conversions are also done automatically when an object of a derived class is assigned to an object of the base class. Though, the c

Can I drop the [] while deleteing array of some built-in type (char, int, etc)? A: No. you can't Sometimes programmers think that the [] in the delete[] p only present so the

is getchar() is a C++ library function?

Readers Writers with Processes and Threads Write two programs implementing ``reader pritority readers-writers synchronization'''' on files. One program will use processes, created


limitation of function

a program to determine whether a number is an odd or even using recursive function

Literals (Constants) Constants are data storage locations whose address is not accessible for the user. Their value is not altered during the course of the program. Literal

Explain the working of Array with Strings? A string is defined in C language as an array of characters. A null character (‘\0') is automatically added to the end of the charact