Professional Documents
Culture Documents
#include<iostream>
using namespace std;
int main()
{
cout<<"name"<<" "<<"id "<<endl;
cout<<"firdiwek sisay"<<" 1510"<<endl;
cout<<"display a pattern like a daimond"<<endl;
cout<<".............................."<<endl;
cout<<endl;
//upper part
for(i=1;i<=row;i++)
{
for(j=1;j<=row-i;j++)
cout<<" ";
cout<<endl;
}
//lower part
for(i=1;i<=row;i++)
{
for(j=1;j<=i;j++)
cout<<" ";
cout<<endl;
}
return 0;
}
2////multiplication table
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
cout<<setw(34)<<"multiplication table";
cout<<"\n";
for(int x=1;x<=12;x++){
cout<<"\n";
for(int y=1;y<=12;y++){
cout<<setw (4)<<x*y;
}
}
return 0;
}
3//////factor
#include<iostream>
using namespace std;
int main()
{
int num, i=1;
cout<<"Enter a Number: ";
cin>>num;
cout<<"\nFactors of "<<num<<" are:\n";
while(i<=num)
{
if(num%i==0)
cout<<i<<" ";
i++;
}
cout<<"\n";
cout<<"end of the program";
return 0;
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{int x=1,y;
Thanks //