Write a function which accepts a sentence as input
parameter.Each word in that sentence is to be reversed.
Space should be there between each words.Return the sentence
with reversed words to main function and produce the
required output.
for eg:- i/p: jack jill jung kill
o/p: kcaj llij gnuj llik
Answer / vivek
#include<stdio.h>
#include<string.h>
char *strrev1(char *st);
void main()
{
char st1[30];
char *pt1;
printf("enter the sentence");
gets(st1);
pt1=strrev1(st1);
puts(pt1);
}
char *strrev1(char *st)
{
int i;
char *pt=st;
for(i=0;st[i]!='\0';i++);
st[i]=' ';
st[i+1]='\0';
i=0;
for(;st[i]!='\0';i++)
{
for(;st[i]!=' ';i++);
st[i]='\0';
strrev(pt);
pt=st+i+1;
st[i]=' ';
}
return(st);
}
| Is This Answer Correct ? | 1 Yes | 1 No |
How to Create a Treeview Menu in ASP.NET with C#?
Write a program to count the number of characters, number of words, number of line in file.
program to check if a number is "perfect number".
How to add a value from textBox over an existing certain column in SQL Server
"c sharp" code for factorial using static variables
Write a program to input an integer and - display the reverse - display the sum of each digit - should include logic that considers the input number as any number of digits long
Code for Reading and writing from a file?
Code for Reading and writing from a file in c#?
Create a class called Accounts which has data members like ACCOUNT no, Customer name, Account type, Transaction type (d/w), amount, balance D->Deposit W->Withdrawal If transaction type is deposit call the credit(int amount) and update balance in this method. If transaction type is withdraw call debit(int amt) and update balance. Pass the other information like Account no,name,Account Type through constructor. Call the show data method to display the values.
program for straight line(y=mx+c)
how does the below eqation proceed to be solved: x*=y+z options: x=x*y+z or x=x*(y+z)
Code for Searching for Multiple Matches with the MatchCollection Class?