0 like 0 dislike
7.8k views

Write a program that reads a string of up to 100 characters, and if its length is less than three characters, it should force the user to enter a new one. Next, the program should read a character and check if the string contains the input character three times in a row. The program should display the position of the first triad found.

Sample input:

fg
DuplicateThis
D

Sample output: 

Not found

 

Sample input: 

Deeeply
e

Sample output:

1

Sample input: 

Deeeppply
p

Sample output:

4

 

[Exercise] Coding (C) - asked in C by (12.1k points)
ID: 22674 - Available when: Unlimited - Due to: Unlimited

edited by | 7.8k views
1 3
Called for Help

82 Answers

0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <stdlib.h>

#include<string.h>



int main(void)

{





    char in[100],c;
* * * ** ** **** **** *** **** * * * * ** * * i,l;
** ** * * * **** *** * ** *** * ** ** * *** * ** * * * * * ** *** *
* * **** * ** ***** * * *** ** * * **** ***
** ** *** *** * ** * **** *** ***** *
** ** * * *** * * * * ** * **** * *
* ***** ** ** ** ** ** ** * **** ** ** ** ** **** *** * **** * *** * ** * **
** ** ***** **** * **** * **** * **** *** * * **** **** *** * *

        }




****** ** * ** *** ** * ** * * ** ** ** ** *** * * * ******
** *** * *** * ** * *** * * * ** **** *** * *

        {
** ** ***** ** * ** ***** * ** * * ***** * *** * ***** * * ** * **** *** ** *
* * * * ** ***** *** ** * * ** ** ** ** ** * * * *
* * * ** * ** ** * ** * *** * * ** * * *** ********* * ***** ** *** * * * * *** * * * * * * ** * ** ** *** * *
**** *** ********** ****** * * * * ** * ** ** * ** * * ** * * * * *** **
* * *** * *** * * * *** * ** * * *** ****** ** *** * * ** ** * * **


* * *** **** ** * ** ** * ** * * ** **
*** * * *** ** * ** **** * *** * ******* * * found\n");

    return EXIT_SUCCESS;

}
answered by (0 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include * ** * *

#include * *** * *

#include <ctype.h>



int main()

{
* * **** *** *** * ** str[100], n;
* * *** **** ** * * ** i, pos=-1;
***** * ***** * ** * *
*** ** ***** **
* *** *** * * * ** * * ** * * *** * ** ** *** * * ** str);
** * * ** * ** *** * * while(strlen(str) < 3);


** * *** * * * *** ** ** * * %c", &n);


** * ** * * * * *** *** **** * i<strlen(str); i++)
***** * ***** ** * *
*** ***** ***** ** ***** **** * ** * *** * * == tolower(n)) && **** * * *** * * && * * ** * ***** * **
** ** *** * ** ** ** * **** * **** **** * *** * ** * ** *
* ******** * * **** **** * * * ** ** * ** * * ** * ** *** ** * = i;
**** **** *** *** * ** * ** ** * * ** ** * * * * *** * * **** ** *** ** ****
** ** * ** ** * * ****** * * * *** *** * ***
** *** **** ***** *


** **** ** ** ** * *** * == -1)
*** * *** ** * *** *** * * * ** ************* ******* ** ** * found");
* * *** ** * ** * *** ** ***
* * *** *********** * * * * * ** ** * * ** * * ** pos);


* ** ** * * * **** ** ******* 0;

}
answered by (5.2k points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.111.110
©2016-2025

Related questions

0 like 0 dislike
56 answers
[Exercise] Coding (C) - asked Mar 9, 2017 in C
ID: 22673 - Available when: Unlimited - Due to: Unlimited
| 5.8k views
0 like 0 dislike
52 answers
[Exercise] Coding (C) - asked Feb 23, 2017 in C
ID: 22017 - Available when: Unlimited - Due to: Unlimited
| 5.5k views
0 like 0 dislike
50 answers
[Exercise] Coding (C) - asked Mar 16, 2017 in C
ID: 22973 - Available when: Unlimited - Due to: Unlimited
| 5.6k views
0 like 0 dislike
90 answers
[Exercise] Coding (C) - asked Mar 16, 2017 in C
ID: 22972 - Available when: Unlimited - Due to: Unlimited
| 9.7k views
12,783 questions
183,442 answers
172,219 comments
4,824 users