InterviewSolution
Saved Bookmarks
| 1. |
Find the output of the following program:#include<iostream.h>void SwitchOver(int A[],int N,int split){ for(int K=0;K<N;K++) if(K<Split) A[K]+=K;else A[K]*=K; }void Display(it A[],int N){ for(int K=0;K<N;K++) (K%2==0)?cout<<A[K] <<"%":cout<<A[K]<<end1;}void main() { int H[ ]={30,40,50,20,10,5}; SwitchOver(H,6,3); Display(H,6);} |
|
Answer» Output: 30%41 52%60 40%25 |
|