write a program to print the consecutive repeated character
from the given string...
input string is : hhhhjkutskkkkkggggj
output should be like this: hhhhkkkkkgggg

anyone help me...



write a program to print the consecutive repeated character from the given string... input string ..

Answer / Mohd Tarique Khan

In C, you can use the following code to solve this problem:nn```n#include <stdio.h>n#include <string.h>nnint main() {n char str[] = "hhhhjkutskkkkkggggj";n int i, j;n for (i = 0; i <= strlen(str); i++) {n if ((i+1) < strlen(str)) {n if (str[i] == str[i+1]) {n for (j = i; j < strlen(str); j++) {n printf "%c", str[j]);n i = strlen(str);n }n }n }n return 0;n}n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

To what value do nonglobal variables default? 1) auto 2) register 3) static

4 Answers  


Why is void main used?

1 Answers  


How the C program can be compiled?

11 Answers   HP,


print a "hello" word without using printf n puts in c language

6 Answers  


There are 3 baskets of fruits with worng lables,one basket has apple,another basket has orange,another has combination of apple and orange,what is the least way of interchange the lables.

15 Answers   Cisco, Google, MBT,


Is there sort function in c?

1 Answers  


What is the use of a semicolon (;) at the end of every program statement?

2 Answers  


WHY DO WE USE A TERMINATOR IN C LANGUAGE?

2 Answers  


You have an array of n integers, randomly ordered with value 1 to n-1.The array is such that there is only one and one value occurred twice. How will you find this number?

1 Answers  


what is the program to display your name in any color?

2 Answers   HCL,


what does " calloc" do?

7 Answers   Cadence, Logos,


Why c is a procedural language?

1 Answers  


Categories