TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Print Alternate Characters From String
Rupesh Kahane
Dec 23
2015
Code
12.5
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
#include<stdio.h>
#include<conio.h>
#include<string.h>
main()
{
// print alternate characters from given string
char
s1[250], s2[250];
int
i = 0, length, j=0;
printf(
"please enter string\n"
);
gets(s1);
length = strlen(s1);
while
(i<length)
{
s2[j]=s1[i];
i=i+2;
j=j+1;
}
s2[j]=
'\0'
;
printf(
"alternate character is:\n"
);
puts(s2);
getch();
}
print alternate characters
string