"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

Add Two Numbers Without Using the Addition Operator

351


Can you explain the four storage classes in C?

637


write a program using linked list in which each node consists of following information. Name[30] Branch Rollno Telephone no i) Write the program to add information of students in linked list

2225


How do we open a binary file in Read/Write mode in C?

674


1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. The Logic should be written in Data Structures?

1909






What is formal argument?

642


I need previous papers of CSC.......plz help out by posting them.......

1809


What is the best way to comment out a section of code that contains comments?

772


What is a volatile keyword in c?

634


Write a C program that will accept a hexadecimal number as input and then display a menu that will permit any of the following operations to be carried out: Display the hexadecimal equivalent of the one's complement. (b) Carry out a masking operation and then display the hexadecimal equivalent of the result. (c) Carry out a bit shifting operation and then display the hexadecimal equivalent of the result. (d) Exit. If the masking operation is selected, prompt the user lor the type of operation (bitwise and, bitwise exclusive or, or bitwise or) and then a (hexadecimal) value for the mask. If the bit shifting operation is selected. prompt the user for the type of shift (left or right), and then the number of bits. Test the program with several different (hexadecimal) input values of your own choice.

4835


What is dynamic variable in c?

558


How we can insert comments in a c program?

623


program for reversing a selected line word by word when multiple lines are given without using strrev

1940


what do you mean by inline function in C?

605


What are the similarities between c and c++?

592