Sunday, 7 January 2018

Learn C language Part 31 Count Frequency of a Character in string





#include <stdio.h>

#include <conio.h>



main()

{



char c[50];

char d;

int i=0,sum=0;



printf("Enter your Name : ");

gets(c);

printf("\nEnter your Searching Character : ");

d=getchar();





while(c[i]!='\0')

{



if(c[i]==d)

{

sum=sum+1;

}

i++;



}





printf("\n\n%c is found %d times in string",d,sum);









}

No comments:

Post a Comment

Pass Dynamically Added Html Table Records List To Controller In Asp.net MVC

Controller Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ...