Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void fun(vector<int>& arr)
- {
- int n=arr.size(),sum=0;
- bool ok=(n<=20);
- for(int i:arr)
- {
- if(i>120 || i<=0) ok=0;
- if(i<17) sum+=200;
- else if(i<=40) sum+=400;
- else sum+=300;
- }
- if(ok) cout<<"Total Income "<<sum<<" INR"<<endl;
- else cout<<"INVALID INPUT"<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement