pgm in c to reverse string by word using array(god is love
becomes love is god)
(no additional array can used,space is only delimiter
between words )
Answers were Sorted based on User's Feedback
Answer / vaibhav srivastava
#include<stdio.h>
int main()
{
char str[50];
int i,j,k;
printf("\nEnter the string\t");
fflush(stdin);
gets(str);
puts(str);
for (i=0; str[i]!='\0';i++);
for ( k=i; k>0; k--)
{ if ( str[k]==' ' || k==i)
{ for( j=k-1; (str[j]!=' ') && (j!=-1) ;j--);
{
while ( ++j!=k)
{printf("%c", str[j]);}
printf(" ");
}
}
}
printf("\n");
}
Is This Answer Correct ? | 22 Yes | 3 No |
Answer / charan
#include <stdio.h>
#include <conio.h>
void main()
{
char *str;
char s[10][10];
int i=0,j=0,p=0;
clrscr();
printf("Enter the string");
gets(str);
while(str)
{
if(str[i]!=' ')
s[j][p++]=str[i];
else
{
s[j][p++]='\0';
p=0;
}
i++;
}
for(i=j;i>=0;i--)
puts(s[i]);
getch();
}
Is This Answer Correct ? | 1 Yes | 10 No |
write a c program to print a given number as odd or even without using loop statements,(no if ,while etc)
write a progam to display the factors of a given number and disply how many prime numbers are there?
What are different types of variables in c?
How can a program be made to print the name of a source file where an error occurs?
How do I declare a pointer to an array?
Without using main fn and semicolon,print remainder for a given number in C language
while initialization of two dimensional arrays we can initialize like a[][2] but why not a[2][] is there any reason behind this?
What is else if ladder?
1)what are limitations for recursive function? 2)write a program to read a text file and count the number of characters in the text file
What is the difference between big endian form and little endian form? write a code to convert big endian form to little endian and vice versa..
what is reason of your company position's in india no. 1.
What is a Genralised LInked List?? Please give a detailed explation of it..