Answer Posted / rohit_kamlakar
#include<iostream.h>
#include<string.h>
#include<stdio.h>
#include<conio.h>
void main()
{
int length,i,j;
char string[500];clrscr();
printf("Enter the string=");
gets(string);
length=strlen(string); int y=length,z=0;
for(i=length-1;i>=0;i--)
{
if(int(string[i])==32)
{ printf(" ");
for(j=i+1;j<length;j++)
{
printf("%c",string[j]);
z++;
}
length=y-z;
}
if(i==0)
{ j=i; printf(" ");
while(int(string[j])!=32)
{
printf("%c",string[j]);
j++;
}
}
}
getch();
}
Is This Answer Correct ? | 3 Yes | 4 No |
Post New Answer View All Answers
what are # pragma staments?
Is it possible to use curly brackets ({}) to enclose single line code in c program?
What is an array in c?
Why does everyone say not to use scanf? What should I use instead?
How do you sort filenames in a directory?
What are the types of c language?
What is strcmp in c?
What is the size of structure pointer in c?
can we have joblib in a proc ?
What is difference between constant pointer and constant variable?
What is variable declaration and definition in c?
Did c have any year 2000 problems?
program to find error in linklist.(i.e find whether any node point wrongly to previous nodes instead of next node)
Explain what are the advantages and disadvantages of a heap?
Why is c called c?