C program to check or know repetance of a alphabet.
In this tutorial we will learn how to write a c program that check the repetance of an alphabet.
In this tutorial we will learn how to write a c program that check the repetance of an alphabet.
C program code
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int i,count=0;
char c,str[100];
clrscr();
printf("\n ENTER A STRING OR SENTENCE:\n ");
gets(str);
printf("\n ENTER A CHARACTER TO CHECK IT'S REPETANCE IN THAT STRING OR SENTENCE:\n ");
scanf("%c",&c);
for(i=0;i<strlen(str);i++)
{
if(str[i]==c)
{
count++;
}
}
printf("\n");
printf("\n LETTER %c REPEATED %d TIMES\n ",c,count);
getch();
}
OUTPUT:
In this output we can see that we will enter a string or sentence,after it we will enter an alphabet to check it's repetance then it print the number of that alphabet repetance.
Please share this post and blog link with your friends.For more programs use this blog.
If you have any problem, please comment in comment box, subscribe this blog for notifications of new post on your email and follow this blog.If you have any method of this program or want to give any suggestion send email on hc78326@gmail.com
Created by-- HARSH CHAUHAN
No comments:
Post a Comment