Write a C program to remove the repeated characters in the
entered expression or in entered characters(i.e) removing
duplicates
Answers were Sorted based on User's Feedback
Answer / balaji ganesh
#include<stdio.h>
main()
{
char s[50];
int i=0,j;
printf("enter character string:");
while((s[i]=getchar())!='\n')
{
for(j=0;j<i;j++)
if(s[j]==s[i])
i--;
i++;
}
printf("after removing the duplicates the string is:");
for(j=0;j<i;j++)
printf("%c",s[j]);
}
Is This Answer Correct ? | 10 Yes | 4 No |
Answer / nallavelli srinivas
MAIN()
{ int lsu=0;
char name[50];
pf("enter the string");
sf("%S",name);
printf(name[0]);
while(name[i]!='\0')
{
if(name[i]!=lsu){pf(name[i]);
lsu=name[i];
}
}
}
Is This Answer Correct ? | 1 Yes | 5 No |
Answer / sowjanya
void main()
{
int rep=0;
char ch,str[50];
printf("enter the string:"):
scanf("%s",str);
printf("enter the character:");
scanf("%s",ch);
for(int i=0;str[i]!='/0';i++)
{
if(str[i]==ch)
{
rep++;//to count character
str[i]=' ';//to delete the duplicate
}
}
printf("the character is repeated %d times",rep);
printf("now all duplicates are deleted.");
}
Is This Answer Correct ? | 5 Yes | 13 No |
I completed my B.tech (IT). Actually I want to develop virtual object that which will change software technology in the future. To develop virtual object what course I have to take. can I any professor to help me.
Define VARIABLE?
Meaning of () in c
What is external variable in c?
What is the most efficient way to store flag values?
Explain what are linked list?
swapping of two numbers without using third variable using AND and OR operators
A set of N billiard balls are set on a one-dimensional table. The table is 1 meter long, set north-south with two pockets at either side. Each ball has zero width and there is no friction so it is moving with a fixed velocity of either northward or southward and bounces back in a perfect elastic collision from other balls it encounter on its way (or drop into one of the pockets). Your job is to keep track of the balls movements. Task Please write a program that gets the initial place, speed and direction of all the balls and gives the position of a specific ball after t seconds. Input The first line contains the number of scenarios. Each one of the other lines in the input contains a scenario: The first number, N, is the number of balls; followed by N pairs of numbers: the distance in centimeters from the south end of the table and the speed (positive speed meaning it moves northward); the last two numbers are the number i of the target ball you should track and the time T in seconds. Output The output is a single number for each line which is the place (distance in centimeters from the south end of the table) of the tracked ball after T seconds. Note: There is no new line character at the end of the result. Sample Input 5 1 50 1 1 1000 1 50 1 1 6 1 60 -2 1 6 2 10 1 95 -1 2 30 2 10 1 95 -1 2 60 Sample Output 100 56 48 65 70
largest Of three Number using without if condition?
what is the height of tree if leaf node is at level 3. please explain
what is the difference between call by value and call by reference?
5 Answers Genpact, Global Logic, Infosys,
what will be the output of this program........ main() { int a=2,b=4,c=6; printf("%d"); } why it gives the value of third variable.