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
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
By using C language input a date into it and if it is right?
What are the types of pointers?
How can I get the current date or time of day in a c program?
a program that can input number of records and can view it again the record
Explain low-order bytes.
What is dynamic variable in c?
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?
Define the scope of static variables.
WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.
Explain the red-black trees?
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 []);
What is call by reference in functions?
How many types of operator or there in c?
What is the purpose of type declarations?