[cpp] c++
Viewer
- #include <iostream>
- using namespace std;
- void mat1(int a,int b,int c)
- {
- int m;
- m = (a+b)*c/(b+4);
- cout<<"m : "<<m;
- }
- void mat2(int a,int b,int c)
- {
- int m;
- m = (c-a)*b/a+1;
- cout<<"m : "<<m;
- }
- int main()
- {
- int a;
- int b;
- int c;
- cout<<"a :";
- cin>>a;
- cout<<endl;
- cout<<"b: ";
- cin>>b;
- cout<<endl;
- cout<<"c: ";
- cin>>c;
- cout<<endl;
- if (a<b<c)
- {
- mat1(a,b,c);
- }
- else if (b<a<c)
- {
- mat2(a,b,c);
- }
- else {
- int m;
- m = (a+b+c)/(2*b+c);
- cout<<endl;
- cout<<"m: "<<m;
- }
- return 0;
- }
Editor
You can edit this paste and save as new: