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 Elements In An Array
Shobana J
Jul 14, 2016
64.3
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
In this blog, you will learn how to print the alternate elements in an array.
prt.zip
Introduction
The logic to print the alternate elements in C is very simple and we initially read the whole array elements and print the alternate elements, using a loop.
Software Requirements
Turbo C++ OR C.
Programming
#include < stdio.h >
void
main()
{
int
array[10];
int
i, j, temp;
printf(
"enter the element of an array \n"
);
for
(i = 0; i < 10; i++) scanf(
"%d"
, & array[i]);
printf(
"Alternate elements of a given array \n"
);
for
(i = 0; i < 10; i += 2) printf(
"%d\n"
, array[i]);
}
Explanation
In the programming, given above, I have clearly explained how to print the alternate elements.
Output
Conclusion
Thus, it is printed and executed successfully.
Print Alternate Elements
Array
Next Recommended Reading
C Program To Print Pascal Triangle