Question number 1;
Write the c++ code to generate the factorial of a given number using for structure.
[hint : factorial of 4 is 4*3*2*1=24]
Question number 2;
Write a c++ code to print the following output using while loops.
2*
4**
6***
මේ ප්රශ්න 2ට solutions විස්තර සහිතව පැහැදිලි කරලා දෙන්න පුළුවන් කෙනෙක් ඉන්නවද?![]()
Question 2
Code:
int main()
{
int x = 1;
while(x <= 5)
{
std::cout << x*2 ;
int y = 0;
while(y < x)
{
std::cout<<"*";
y++;
}
std::cout<<"\n";
x++;
}
}
Code:
2*
4**
6***
8****
10*****



හෙට exam 



