#include<iostream.h>
int f(int x) //fungsi f(x)
//hanya mengenal x dan y
{ int y;
y=x*x+3;
return y;
}
int g(int a) //fungsi g(a)
//hanya mengenal a
{
return (a*a-3);
}
int hasil (int a, int b)
{
return (a+b);
}
main ()
{ int a;
cout<<"f(x)=x^2+3\tg(x)=x^2-3"<<endl;
cout<<"Masukkan nilai x : ";
cin>>a;
cout<<"f("<<a<<")\t\t="<<f(a)<<endl;
cout<<"f(1)\t\t="<<f(1)<<endl;
cout<<"f(2 x "<<a<<")\t="<<f(2*a)<<endl;
cout<<"2f("<<a<<")\t\t="<<2*f(a)<<endl;
cout<<"g("<<a<<") \t\t="<<g(a)<<endl;
cout<<"f(1+"<<a<<")+g("<<a<<"-1)\t="<<f(1+a)+g(a-1)<<endl;
int f(int x) //fungsi f(x)
//hanya mengenal x dan y
{ int y;
y=x*x+3;
return y;
}
int g(int a) //fungsi g(a)
//hanya mengenal a
{
return (a*a-3);
}
int hasil (int a, int b)
{
return (a+b);
}
main ()
{ int a;
cout<<"f(x)=x^2+3\tg(x)=x^2-3"<<endl;
cout<<"Masukkan nilai x : ";
cin>>a;
cout<<"f("<<a<<")\t\t="<<f(a)<<endl;
cout<<"f(1)\t\t="<<f(1)<<endl;
cout<<"f(2 x "<<a<<")\t="<<f(2*a)<<endl;
cout<<"2f("<<a<<")\t\t="<<2*f(a)<<endl;
cout<<"g("<<a<<") \t\t="<<g(a)<<endl;
cout<<"f(1+"<<a<<")+g("<<a<<"-1)\t="<<f(1+a)+g(a-1)<<endl;
}
{ 0 komentar... Views All / Send Comment! }
Posting Komentar