Skip to content

Instantly share code, notes, and snippets.

@vertrigo
Created November 27, 2012 16:17
Show Gist options
  • Select an option

  • Save vertrigo/4155180 to your computer and use it in GitHub Desktop.

Select an option

Save vertrigo/4155180 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <conio.h>
#include <string.h>
void main()
{
int i,k=0;
char *st="";
clrscr();
printf("Введите строку символов: \n");
scanf("%s",st);
printf("\nИсходная строка: \n%s \n",st);
for(i=0;i<strlen(st)-1;i++){
if (*(st+i)==*(st+i+1))
{
k=1;
printf("В строке присутствуют удвоенные символы:\n");
printf("%c",st[i]);
printf("%c\n",st[i+1]);
}
}
if (!k)
{
printf("В строке нет удвоенных символов");
}
getch();
}
#include <stdio.h>
#include <conio.h>
#include <string.h>
void main()
{
int i,k=0;
char *st="";
clrscr();
printf("Vvedite stroku: \n");
scanf("%s",st);
printf("\nIshodnaja stroka: \n%s \n",st);
for(i=0;i<strlen(st)-1;i++){
if (*(st+i)==*(st+i+1))
{
k=1;
printf("V stroke est udvoennie simvoli:\n");
printf("%c",st[i]);
printf("%c\n",st[i+1]);
}
}
if (!k)
{
printf("V stroke net udvoennih simvolov");
}
getch();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment