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
Is c weakly typed?
What is a class c rental property?
What is the time and space complexities of merge sort and when is it preferred over quick sort?
What is the significance of scope resolution operator?
difference between Low, Middle, High Level languages in c ?
What is the correct declaration of main?
What is the advantage of using #define to declare a constant?
Can you please explain the difference between exit() and _exit() function?
By using C language input a date into it and if it is right?
What are the 4 types of programming language?
please can any one suggest me best useful video tutorials on c i am science graduate.please help me.u can email me to sas29@in.com
What is the scope of static variable in c?
What is type qualifiers?
what are the program that using a two dimensional array that list the odd numbers and even numbers separately in a given 10 inputs values
write a program that will open the file, count the number of occurences of each word in the the complete works of shakespeare. You will then tabulate this information in another file.