View Code of Problem 114

#include <stdio.h>
#include <string.h>
void nixv()
{
    char st[100],st2[100];
    int n[100];
    int i,j,k,count=1,x=0;
    j=0;
    while (gets(st))
    {	
    for(i=0; i<strlen(st); i++)
    {
        if(st[i]==' '||i==strlen(st)-1)
        {
            k=i;
            
           if(i==strlen(st)-1)
           {
               st2[x] =' ';
               x++;
           }
            for(k=i; k>=j; k--)
            {
                st2[x] = st[k];
                x++;
            }
            j=i+1;
        }
    }
    for (i=1; i<x; i++)
    {
    	printf("%c", st2[i]);
    }
    printf("\n");
    j =0; x =0;
	}
}
int main(void)
{
    nixv();
    return 0;
}

Double click to view unformatted code.


Back to problem 114