write an algorithm to get a sentence and reverse it in the
following format:
input : I am here
opuput: Here Am I
note: first letter of every word is capiatlised

Answer Posted / anshu ranjan

#include<stdio.h>
#include<string.h>
#include<stdlib.h>

void main()
{char *s,*t;
int i=0,j=0;
s=(char *)malloc (1000*sizeof(char));
t=(char *)malloc (50*sizeof(char));
gets(s);
i=strlen(s)-1;
while(i>=-1)
{
if(s[i]!=' ' && i>=0)
t[j++]=s[i--];
else {if(t[j-1]>=97 && t[j-1]<=122)
t[j-1]-=32;
i--;
t[j]=0;
//printf("%s ",t);
strrev(t);
printf("%s ",t);
j=0;
}
}
}

Is This Answer Correct ?    10 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above

707


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

574


What are the types of pointers?

600


How can I get the current date or time of day in a c program?

652


a program that can input number of records and can view it again the record

1484






Explain low-order bytes.

623


What is dynamic variable in c?

567


Q.1 write a program to create binary tree 1 to 16 numbers? Q.2 write a program to creat a binary search tree for the member that is given by user?

2055


Define the scope of static variables.

606


WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.

2028


Explain the red-black trees?

608


write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);

1848


What is call by reference in functions?

567


How many types of operator or there in c?

603


What is the purpose of type declarations?

679