"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


Please Help Members By Posting Answers For Below Questions

What is #line used for?

583


Where static variables are stored in memory in c?

524


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

1487


What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.

1786


What is the best organizational structure?

644






What are the different types of C instructions?

679


What is the use of structure padding in c?

564


Find the second largest element in an array with minimum no of comparisons and give the minimum no of comparisons needed on an array of size N to do the same.

721


What is openmp in c?

613


what is the different bitween abap and abap-hr?

1745


When is a “switch” statement preferable over an “if” statement?

651


Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.

670


What is "Hungarian Notation"?

638


How do I get an accurate error status return from system on ms-dos?

650


Difference between pass by reference and pass by value?

659