+ 1

Is it correctly?(Calculate the factor of number)

#include<iostream> using namespace std; int main(){ int k; int f=1; int counter=1; cin>>k; A: f=f*counter; counter++; if(counter<=k) goto A; cout<<f; return 0; }

27th Mar 2019, 9:42 PM
Robi
1 Odpowiedź
+ 2
Yes, it works fine.
28th Mar 2019, 12:23 AM
Denise Roßberg
Denise Roßberg - avatar