Tuesday, March 1, 2016

Array Indexing and Printing in C

1:  #include<stdio.h>  
2:  #include<stdlib.h>  
3:    
4:  int main()  
5:  {  
6:      int n[10];  
7:      int m[]={2,4,5,8,10};  
8:      int p[50]={0};  
9:    
10:      int i,k;  
11:      for(i=0; i<=9; i++){  
12:          scanf("%d",&n[i]);  
13:      }  
14:            
15:          for(k=1; k<=10; i++){  
16:              printf("%d no. value is %d",k,n[k-1]);  
17:          }  
18:        
19:      return 0;  
20:  }  

No comments:

Post a Comment

Thank you for commenting. Please wait for response :)