Assignment

please change karna


Q1
#include<iostream>
using namespace std;
int main()
{
int a[5],b[5],s[5],k;
cout<<"Enter an elemenntL";
for(k=0;k<5;k++)
cin>>a[k];
cout<<"Enter an elemenntL";
for(k=0;k<5;k++)
cin>>b[k];
for(k=0;k<5;k++)
s[k]=a[k]+b[k];
cout<<"M1";
for(k=0;k<5;k++)
cout<<a[k]<<" ";
cout<<"M2";
for(k=0;k<5;k++)

cout<<b[k]<<" ";
cout<<"Sum";
for(k=0;k<5;k++)
cout<<s[k]<<" ";
}
q2
#include<iostream>
using namespace std;
int main()
{
int a[5],k;
cout<<"Enter an elemenntL";
for(k=0;k<5;k++)
{
cin>>a[k];
}
for(k=0;k<5;k++)
{
cout<<a[k]<<" ";
}
}
q3
#include<iostream>
using namespace std;
int main()
{
int a[3][3],b[3][3],i,j;
cout<<"Enter an element:"<<endl;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cin>>a[i][j];

}
}
cout<<"matrix"<<endl;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cout<<a[i][j]<<" ";
}
cout<<endl;
}
return 0;
}
q4
#include<iostream>
#include<dos.h>
using namespace std;
int main()
{
char a[3][3],b[3][3];
int i,j;
cout<<"Enter an element:"<<endl;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cin>>a[i][j];

}
}
cout<<"Enter an element:"<<endl;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cin>>b[i][j];

}
}
cout<<"matrix"<<endl;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cout<<a[i][j]<<" ";
}
cout<<endl;
}
cout<<"matrix 2"<<endl;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cout<<b[i][j]<<" ";
}
cout<<endl;
}
return 0;
}
q4
#include<iostream>
using namespace std;
int main()
{
int a[3],i,j[3],d;
for(i=0;i<3;i++)
{
cin>>a[i];

}for(i=0;i<3;i++)
{
cout<<a[i]<<" ";
}for(i=1;i<3;i++)
{
d=a[1];
if(d>a[i+1])
j[i]=a[i];
}
cout<<j[i];
}
q5
#include <iostream>
using namespace std;

int hcf(int n1, int n2);

int main()
{
   int n1, n2;

   cout << "Enter two positive integers: ";
   cin >> n1 >> n2;

   cout << "H.C.F of " << n1 << " & " <<  n2 << " is: " << hcf(n1, n2);

   return 0;
}

int hcf(int n1, int n2)
{
    if (n2 != 0)
       return hcf(n2, n1 % n2);
    else
       return n1;
}
q6
#include<iostream>
#include<dos.h>
using namespace std;
int main()
{
int a[3][3],b[3][3],s[3][3],i,j;
cout<<"Enter an element:"<<endl;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cin>>a[i][j];

}
}
cout<<"Enter an element:"<<endl;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cin>>b[i][j];

}
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
s[i][j]=a[i][j]+b[i][j];

}
}
cout<<"matrix"<<endl;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cout<<a[i][j]<<" ";
}
cout<<endl;
}
cout<<"matrix 2"<<endl;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cout<<b[i][j]<<" ";
}
cout<<endl;
}
cout<<"Sum"<<endl;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cout<<s[i][j]<<" ";
}
cout<<endl;
}
return 0;
}
q7
#include<iostream>
#include<dos.h>
using namespace std;
int main()
{
char a[3][3],b[3][3];
int i,j;
cout<<"Enter an element:"<<endl;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cin>>a[i][j];

}
}
cout<<"matrix"<<endl;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cout<<a[i][j]<<" ";
}
cout<<endl;
}
cout<<"TRANSPOSE"<<endl;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cout<<a[j][i]<<" ";
}
cout<<endl;
}
return 0;
}

Comments

Popular posts from this blog

Stack

Operation on Single Linked List

EXTRA INFORMATION ABOUT TECHNOLOGY