Advertisement
a53

Gradient

a53
Jan 19th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int R1,G1,B1,R2,G2,B2,n;
  7. cin>>R1>>G1>>B1>>R2>>G2>>B2>>n;
  8. cout<<R1<<", "<<G1<<", "<<B1<<'\n';
  9. --n;
  10. int r=R2-R1,g=G2-G1,b=B2-B1;
  11. for(int i=1;i<=n;++i)
  12. cout<<(int)(R1+r*i/(float)n)<<", "<<(int)(G1+g*i/(float)n)<<", "<<(int)(B1+b*i/(float)n)<<'\n';
  13. return 0;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement