"I LOVE MY COUNTRY"
write a c program to get "COUNTRY MY LOVE I" as the output.
Use any other programming language. It is not mandatory to
use C.
Answer Posted / rabi
#include<bits/stdc++.h>
using namespace std;
int main()
{
char s[100];
//string s;
gets(s);
int len=strlen(s);
int no;
for(int i=len-1;i>=0;i--)
{
if(i==0)
{
no=i;
while(s[no]!=' ')
{
cout<<s[no];
no++;
//if(s[i]==' ')
//break;
}
}
if(s[i]==' ')
{
no=i+1;
while(s[no]!=' ')
{
cout<<s[no];
no++;
if(s[no]=='' || s[no]==' ')
break;
}
cout<<" ";
}
}
}
Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
When c language was developed?
What is a 'null pointer assignment' error?
What is #include cctype?
how to find anagram without using string functions using only loops in c programming
When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?
praagnovation
In c programming, explain how do you insert quote characters (? And ?) Into the output screen?
How can I get back to the interactive keyboard if stdin is redirected?
what is the basis for selection of arrays or pointers as data structure in a program
Write a client and server program in C language using UDP, where client program interact with the Server as given below: i) The client begins by sending a request to send a string of 8 characters or series of 7 numbers, the server sends back a characters or numbers as per the request of the client. ii) In case of series of 7 numbers: The client sends a multiplication of numbers, to the server. iii) In case of a string of 8 characters: The client sends a reverse order of string to the server.. iv) Server will send an acknowledgment to the client after receiving the correct answer
Does c have an equivalent to pascals with statement?
#include show(int t,va_list ptr1) { int a,x,i; a=va_arg(ptr1,int) printf(" %d",a) } display(char) { int x; listptr; va_star(otr,s); n=va_arg(ptr,int); show(x,ptr); } main() { display("hello",4,12,13,14,44); }
Do string constants represent numerical values?
Why flag is used in c?
What is declaration and definition in c?