Computer Science, asked by robinsons, 10 months ago

write a c++ programme
functions
1-no return no argument
write a function void simple()
this function will enter p,r,t and calculate the simple interest and display the result
from main just call this function
2-no return with argument
Q2.create a function void showcube(int num)
this function will calculate the cube of passed num and display the result
from main you will enter a num and pass this num to function
3-with return no argument
create a function int fact() and this will enter a num and return the factorial of entered nun to main
in main just call the function and show the result in main
4-with return with argument
create a function int total(int a, int b, int c)
this function will calculate these passed three numbers sum and return to main In main enter 3 numbers and pass these to functionand display the result in main 49m 46s

Answers

Answered by venkatavineela3
0

Answer:

Explanation:

1.#include<iostream>

using namespace std;

void simple()

{

int p,t,r;

cout<<"enter p,t,r";

cin>>p>>t>>r;

float s=(p*t*r)/100;

cout<<s;

}

int main()

{

simple();

return 0;

}

Q2. cube of a number:

#include<iostream>

using namespace std;

void showcube(int a)

{

 

int c=a*a*a;

cout<<c;

}

int main(int argc, char** argv)

{

int a;

cout<<"enter a value";

cin>>a;

cube(a);

return 0;

}

3. #include<iostream>

using namespace std;

int fact()

{

int n,f=1;

cout<<"enter n";

cin>>n;

int i;

for(i=1;i<=n;i++)

 f=f*i;

return f;

}

int main(int argc, char** argv)

{

int factorial;

factorial=fact();

cout<<factorial;

return 0;

}

4. #include<iostream>

using namespace std;

int total(int a,int b,int c)

{

int d=a+b+c;

return d;

}

int main(int argc, char** argv)

{

int sum,a,b,c;

cout<<"enter a,b,c";

cin>>a>>b>>c;

sum=total(a,b,c);

cout<<sum;

return 0;

}

Similar questions