Display string vertically

Q. Write a C program to read a string from user and display it in vertical.
For example: Entered String is : Sample String
After programmed, resulted string is : 
S
a
m
p
l
e


S
t
r
i
n
g


Ans.


/*c program for display a string in vertical*/
#include<stdio.h>
#include<conio.h>
int main()
{
 int i;
 char str[30];
 printf("Enter any string : ");
 gets(str);
 for(i=0; str[i]!='\0'; i++)
   printf("%c\n",str[i]);
 getch();
 return 0;
}


/***************Output******************/


Output of display string vertically C program
Screen shot for display string vertical C program


Related programs:

  1. Reverse all string
  2. Reverse all words but not string
  3. Reverse each first character of word & add extra word
  4. Change title case of string
  5. Search sub string from main string
  6. Search sub string individual from main string
  7. Position and repetition of character in string

Comments