+ 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; }
1 ответ
+ 2
Yes, it works fine.
#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; }