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
A: This is a name that acts as an alias, or alternative name, for a beforehand defined variable or an object. prepending variable along with "&" symbol makes it as reference. fo

At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers



The Switch Construct The switch statement is a multi-way decision-making construct that tests an expression matches one of a number of constant values, and branches accordingly

Write a program to compute the following equation for values of time.           y = 2x+3   The values of time are stored in the file program.dat and the solution should be display

1. write a program named InputMethodDemo2 that eliminates the repetitive code in the InputMethod() in the InputMethodDemo program. Rewrite the program so the InputMethod()contains

Imagine that the server program is a setuid program owned by the root, then after you penetrate the program with a shell running, you become the ROOT and you can remove the whole f


within 2 mins give me answer pllzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz