Monday 27 August 2012

Array002

Input five numbers in an array and transfer these numbers in reverse order to a different array.

#include <stdio.h>
#include <conio.h>

void main ( )
{
            int        no1[5], no2[5], i, j = 4;
            clrscr ( );
                                   
            printf ("\n\t Number transfer from one array to another array\n\n");
                                            
            for ( i = 0; i <= 4; i++ )
            {                                                     
                            printf ("\n\t\t\t Enter a number......:"); scanf ("%d", & no1[i]);
                                                       
                            no2[ j--] = no1[i];
            }                                               
            for ( i = 0; i <= 4; i++ )
            {                                                        
                            printf ("\n\t Number in 1st array : - %d \t Number in 2nd array : - %d",
                                               no1[i], no2[i]);
            }
            getch ( );   
}



Click here to contact us

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...