Write two functions Show whole program in C A function calle

Write two functions: Show whole program in C++ A function called \'modulus\' evaluates and returns the modulus of a variable \'y.\' Note, the modulus of -3 is 3, and the modulus of +6 is 6. A second function called \'simple\' which evaluates simple = n!/(n - k)! middot k!.

Solution

Answer:

#include<iostream.h>

#include<conio.h>

void simple(int n,int k);

void modulas(int y)

{

if(y>0)

{

cout<<\"modulas of variable:=\"<<y;

}

else

{

cout<<\"modulas of variable:=\"<<-y;

}

}

void simple(int n,int k)

{

int i,l,p,s;

l=n;

p=k;

s=l-p;

for(i=n;i>1;i--)

{

n=n*(i-1);

}

for(i=s;i>1;i--)

{

s=s*(i-1);

}

for(i=k;i>1;i--)

{

k=k*(i-1);

}

int w=n/(s*k);

cout<<\"\ \ simple=\"<<w;

}

void main()

{

int y,n,k;

clrscr();

cout<<\"enter a no.:=\";

cin>>y;

modulas(y);

cout<<\"\ \ part-b\ \ \ enter value of n=\";

cin>>n;

cout<<\"\ \ enter value of k=\";

cin>>k;

simple(n,k);

getch();

}

 Write two functions: Show whole program in C++ A function called \'modulus\' evaluates and returns the modulus of a variable \'y.\' Note, the modulus of -3 is
 Write two functions: Show whole program in C++ A function called \'modulus\' evaluates and returns the modulus of a variable \'y.\' Note, the modulus of -3 is

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site