+ 2
C++ coding
Enter the digit to show is factorial (for eg enter 5) Result 1 2 3 4 5 should be shown how to do in c++
10 ответов
+ 4
Please show us your attempts at the problem first.
+ 3
int a;
cin >>a;
int tot=1;
int b =1;
while (a != 0){
cout<< b << " ";
tot = tot * a;
a--;
}
cout <<tot;
0
int i,n;
c=0;
cout<<“enter the digit”;
cin>>n;
for(i=0;i<=n;i++)
c-;
cout<<n<<endl;
0
correct to get desired result
0
#include <iostream>
using namespace std;
int main()
{
int user_input;
cout << "enter a number\n";
cin >> user_input;
for(int i = 1; i <= user_input; i++){
cout << i ;
}
return 0;
}
0
yes thnks
0
if i want factorial like eg if put 5 then its factorial result should be shown 120
0
can anyone tell im taking course of c++ where do i can practice more example to clear my understanding more to c++ coding any tips suggestion
0
#include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=1; i<=n; i++)
{
cout<<i<<" ";
}
return 0;
}