"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
What is the purpose of clrscr () printf () and getch ()?
Can an array be an Ivalue?
In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.
What does 3 mean in texting?
Explain function?
Is fortran faster than c?
How can I run c program?
what do you mean by inline function in C?
Write a program to print all permutations of a given string.
What are linker error?
What does void main () mean?
Describe the steps to insert data into a singly linked list.
What is header file definition?
What is line in c preprocessor?
What is volatile keyword in c?