60 469
Assignments Done
98,1%
Successfully Done
In April 2018

Answer to Question #16433 in C++ for arif hussain

Question #16433
Q#1 • Write a program to find the factorial of a number using structure
Expert's answer
#include<iostream>
using namespace std;

struct factorial{
long unsigned int num, fac;
} f;

factorial *F;

void main(){
F = &f;
cout<<"enter a positive integer: ";
cin>>F->num;
F->fac = 1;
for (int i=2; i<=F->num; ++i) F->fac *= i;
cout<<F->num<<"! = "<<F->fac<<"\n";
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions