Use app×
QUIZARD
QUIZARD
JEE MAIN 2026 Crash Course
NEET 2026 Crash Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
934 views
in Computer by (69.2k points)

Write a C program to rearrange the elements of an array so that those originally stored at odd suffixes are placed before those at even suffixes

1 Answer

+1 vote
by (70.0k points)
selected by
 
Best answer

A C program to rearrange the elements of an array so that those originally stored at odd suffixes are placed before those at even suffixs:

main()

{

char a[25],ch,temp;

int i;

clrscr();

printf ("\nEnter the string:-> ");

gets(a);

for (i=0;a[i]!='\0';i++)

{

if (a[i+1]=='\0')break;

temp=a[i];

a[i]=a[i+1];

a[i+1]=temp;

i++;

}

puts(a); getch();

}  

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...