C program to input any string and determine Whether the string contain double character or not.

C program to input any string and determine Whether the string contain double character or not.

#include<stdio.h>
#include<conio.h>
void main( )
{
char str[20]; int i;
clrscr( );
printf("enter any string ");
scanf("%s",str);
i=0;
while(str[i]!='\0')
{
if(str[i]==str[i+1])
{
printf("Double character %c\n", str[i]);
}
i=i+1;
}
getch( );
}

Post a Comment

0 Comments