Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- int R1,G1,B1,R2,G2,B2,n;
- cin>>R1>>G1>>B1>>R2>>G2>>B2>>n;
- cout<<R1<<", "<<G1<<", "<<B1<<'\n';
- int r=abs(R2-R1)/(n-1),g=abs(G2-G1)/(n-1),b=abs(B2-B1)/(n-1);
- for(int i=2;i<n;++i)
- {
- if(R1<R2)
- R1+=r;
- else
- R1-=r;
- if(G1<G2)
- G1+=g;
- else
- G1-=g;
- if(B1<B2)
- B1+=b;
- else
- B1-=b;
- cout<<R1<<", "<<G1<<", "<<B1<<'\n';
- }
- cout<<R2<<", "<<G2<<", "<<B2<<'\n';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement