1) Create a flowchart for the program below and Trace the program below with input of 3 and then again with input of 5.
#include <iostream>
using namespace std;
int Fall(int x, int m)
{ int Xm = 1, i=x;
while(i>=x-m+1)
{ Xm = Xm*i;
i=i-1;
}
return Xm;
}
int Delta(int x, int m)
{ int ans = 0;
ans = Fall(x+1,m);
ans = ans - Fall(x,m);
return ans;
}
void main()
{ int x = 0, m = 2, ans = 0, i=0, j=1;
cout<<"Enter a Number\n";
cin>>x;
cout<<" x \\ m |";
m=1;
while(m<x)
{ cout<<" "<<m;
m=m+1;
}
cout<<endl;
i=0;
while( i<=x)
{ cout<<"_____";
i=i+1;
}
cout<<endl;
j=1;
while(j<=x)
{ cout<<" "<<j<<" |";
m=1;
while( m<x)
{ ans = Delta(j,m);
cout<<" "<<ans;
m=m+1;
}
cout<<endl;
j=j+1;
}
}
Answer: Here, is the flowchart for your problem.
OUTPUT for input x=3;
OUTPUT for input x=5;
Please let me know if still not clear. Hope you got your answer :)
Get Answers For Free
Most questions answered within 1 hours.