Generare siruri
#include<iostream.h>
#include<conio.h>
main()//sa se calculeze 1+1*2+1*2*3+...+1*2*...*n
{int n,i,s=0,p=1;
clrscr();
cout<<"dati pe n ";cin>>n;
for(i=1;i<=n;i++)
{p=p*i;cout<<p<<",";}
getch();
//o.k
}
////////////////
#include<iostream.h>
#include<conio.h>
void main()
{ float x1,x0,t,n,i;
clrscr();cout<<"n="; cin>>n;
x0=1; x1=2;
for(i=1;i<=n;i++)
{ t=2*x1+x0; cout<<t<<" ";
x0=x1; x1=t;}
getch();
}
///////
#include<iostream.h>
#include<conio.h>
int n,i,k,j;
void main(){
clrscr();
cout<<"n=";
cin>>n;
for(i=1;i<=n;i++) {
for(j=1;j<=i;j++) cout<<j<<",";
for(k=1;k<=i-1;k++) cout<<i<<",";
cout<<endl; }
getch(); } //ok
/////////
#include<iostream.h>
main()//sa se calculeze 1+1*2+1*2*3+...+1*2*...*n
{int n,i,s=0,p=1;
cout<<"dati pe n ";cin>>n;
for(i=1;i<=n;i++)
{
p=p*i;s=s+p;
}
cout<<"suma este "<<s;
endl; //o.k
}