hello !! i want to ask that in below program if i want to change cin and cout into printf and scanf then how colud i?Becuse when iam changing my program in cin and cout it is not running :(
#include <iostream>
#include <iomanip>
int main () {
long number; // the number to use to calculate its factorial
long factor; // the factorial of the number
long term; // next term to use in the calculation
// prompt and get the first number
std::cout << "Enter a number or -1 to quit: ";
std::cin >> number;
while (number >= 0 && std::cin)
{
// calculate number factorial
factor = 1;
for (term=2; term <= number; term++)
{
factor *= term;
}
// output number and its factorial
if(number == 1)
{
std::cout << number << "! = 1*1=1" <<std::endl;
}
else
{
std::cout << number << "! = " ;
for (int k=2; k<number+1; ++k)
{
std::cout<<number+2-k<<"*";
}
std::cout <<"1 ="<< factor <<std::endl;
}
// get another number to do
std::cout << "Enter a number or -1 to quit: ";
std::cin >> number;
}
return 0;
}