How to removing white spces in c programming only bu using
loops

Answers were Sorted based on User's Feedback



How to removing white spces in c programming only bu using loops..

Answer / ranj

Aravind has done few mistake in printing the no,
the correct format should like this

int main()
{
int i,number;
char str[10];
gets(str);
number=strlen(str);
printf("String without white space\n");
for(i=0;i<number;i++)
{
if(str[i]==' ');
else
printf("%c",str[i]);
}
}

Is This Answer Correct ?    5 Yes 0 No

How to removing white spces in c programming only bu using loops..

Answer / aravind

int main()
{
int i;
char str[10];
gets(str);
for(i=0;i<=number;i++)
{
if(str[i]==' ')
str[i]=0;
}
printf("string without white space is=%s",str);
}

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More C Interview Questions

By using C language input a date into it and if it is right?

0 Answers   Aricent,


prog for 1st five prime numbers in 2^x - 1

0 Answers  


What is the main difference between calloc () and malloc ()?

0 Answers  


What is the use of f in c?

0 Answers  


write a program to display numbers from 1 to 10 and 10 to 1?

2 Answers  


how to find a 5th bit is set in c program

4 Answers   IBM,


i want to know the procedure of qualcomm for getting a job through offcampus

0 Answers   HCL,


Explain what is meant by high-order and low-order bytes?

0 Answers  


There are N egg baskets and the number of eggs in each basket is a known quantity. Two players take turns to remove these eggs from the baskets. On each turn, a player must remove at least one egg, and may remove any number of eggs provided they all belong to the same basket. The player picking the last egg(s) wins the game. If you are allowed to decide who is going to start first, what mathematical function would you use to decide so that you end up on the winning side?

8 Answers   Google,


#define DCHAR char* typedef char* TCHAR; if using these following variables will be declared like DCHAR ch1, ch2; TCHAR ch3, ch4; then what will be types of ch1, ch2, ch3 and ch4?

6 Answers   NDS,


atoi, which takes a string and converts it to an integer. write a program that reads lines(using getline), converts each line to an integer using atoi and computes the average of all the numbers read. also compute the standard deviation

0 Answers  


How to print %d in output

6 Answers   Wipro,


Categories