JoBat update

A Virtual World of Infotainment :)

Reverse string model 

Write a C program to reverse the given string

Sample input   : jobat update
Sample output : update jobat


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>

int main()
{
    char str[50];
    gets(str);
    int len;
    for(int i=0;str[i];len++,i++); //length of string
    for(int i=len-1;i>=0;i--)
    {
        if(str[i]==' ' || i==0)
        {
            if(i==0)
                printf("%c",str[0]);
            for(int j=i+1;str[j]!=' '&&str[j]!='\0';j++)
                printf("%c",str[j]);
            printf(" ");
        }
    }
    return 0;
}

OUTPUT:


Newer Posts Older Posts Home

SUBSCRIBE & FOLLOW

POPULAR POSTS

  • Middlewares in Express JS
  • Fab Four
  • Vada Chennai Review
  • JBM awards 2k18

Categories

  • Awards 4
  • Code 23
  • Review 16
  • sport 1
  • Tech 2
  • Update 14

Contact Form

Name

Email *

Message *

  • ►  2020 (1)
    • ►  July (1)
  • ►  2019 (7)
    • ►  October (1)
    • ►  July (1)
    • ►  February (1)
    • ►  January (4)
  • ▼  2018 (33)
    • ►  October (2)
    • ►  September (3)
    • ▼  August (1)
      • Reverse string model
    • ►  July (3)
    • ►  June (4)
    • ►  April (8)
    • ►  March (7)
    • ►  February (1)
    • ►  January (4)
  • ►  2017 (17)
    • ►  December (3)
    • ►  November (6)
    • ►  October (8)

Search This Blog

Powered by Blogger.

Report Abuse

HOME

  • HOME
  • Code Block
  • Tech World
  • How is it?
  • What's Up?
  • JoBatMovie_Awards
  • Sports Block
  • Privacy Policy

JoBatMovie Awards

  • Home
  • JoBatMovie Awards
  • Home

Featured post

JBM awards 2k18

JoBat Updates

Designed by OddThemes | Distributed by Gooyaabi Templates