Computer Science, asked by LegendaryQueen, 11 months ago

Guys plz help in C++



plzzzzz. ...​

Attachments:

Answers

Answered by Anonymous
1

a)#include <iostream>

  using namespace std;

  int main()

  {

int i;

for(i=15; i>=1; i--)

       {

 cout<<i<<"\t";

       }

return 0;  

  }

b)#include <iostream>

  using namespace std;

  int main()

  {

int i,n;

cout<<"Enter a number: ";

cin>>n;

for(i=1; i<=6; i++)

       {

 cout<<n<<"\t";

       }

return 0;  

 

  }

c)#include <iostream>

  using namespace std;

  int main()

  {

int i,n,m;

cout<<"Enter a number: ";

cin>>n;

for(i=1; i<=10; i++)

{

 m = i*n;

 cout<<m<<"\t";  

}

return 0;

  }

d)#include <iostream>

  using namespace std;

  int main()

  {

int n,s;

n = 15;

s = n*(n+1)/2; //This is an equation to find the sum of n natural numbers.

cout<<s;

return 0;    

 }

Hope it helps :)


LegendaryQueen: thanks a lot
Anonymous: You are also do the the 'd' question using a for loop.
Anonymous: You're welcome.
Similar questions