This program accepts a list of numbers and displays it in reverse order using function concept.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #include "stdio.h" #include "conio.h" int a[5],b[5]; void accept() { int j; printf("Enter the list \n"); for(j=0;j=0;j--,i++) { b[i]=a[j]; } } void display() { int j; printf("The list in reverse is \n"); for(j=0;j<5;j++) printf("%d ",b[j]); printf("\n"); } void main() { accept(); reverse(); display(); getch(); } |
Output:
Enter the list 5 4 3 2 1 The list in reverse is 1 2 3 4 5 |
Description :
This is the one stop educational site for all Electronic and Computer students. If you want to learn something new then we are here to help. We work on Microcontroller projects, Basic Electronics, Digital electronics, Computer projects and also in basic c/c++ programs.
#Home #Sitemap #Resources #Terms of Use
Copyright©2012 electrofriends.com All Rights Reserved
Contact:info@electrofriends.com