int main()
{
int a,b,c,d,enc,ext;
cout << "Enter Your First Digit:" << endl;
cin >> a;
cout << "Enter Your Second Digit:" << endl;
cin >> b;
cout << "Enter Your Third Digit:" << endl;
cin >> c;
cout << "Enter Your Fourth Digit:" << endl;
cin >> d;
a += 7;
b += 7;
c += 7;
d += 7;
a /= 10;
b /= 10;
c /= 10;
d /= 10;
cout << "Your encrpyted digits:" << c << d << a << b <<endl;
if (ext = 1) {
exit(EXIT_SUCCESS);
}
}
2(a)
#include<iostream>
8 int main(){
9 int mat[3][3], i, j;
10 float determinant = 0;
11
15 cin>>mat[i][j];
16
19 cout<<"\n";
20
22 cout<<mat[i][j]<<"\t";
23 }
26 mat[2][(i+1)%3]));
27
28 cout<<"\n\ndeterminant: "<<determinant;
29
30 cout<<"\n\nInverse of matrix is: \n";
34 mat[(j+2)%3][(i+1)%3]))/ determinant<<"\t";
35
36 cout<<"\n";
37 }
return 0;
3(a)
#include<iostream.h>
#include<conio.h>
void main()
{
int i,a[10],temp,j;
clrscr();
cout<<"Enter any 10 num in array: \n";
for(i=0;i<=10;i++)
{
cin>>a[i];
}
cout<<"\nData before sorting: ";
for(j=0;j<10;j++)
{
cout<<a[j];
}
for(i=0;i<=10;i++)
{
for(j=0;j<=10-i;j++)
{
if(a[j]>a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
cout<<"\nData after sorting: ";
for(j=0;j<10;j++)
{
cout<<a[j];
}
getch();
}
3(b)
#include < iostream>
using namespace std;
int main()
{
int a, b, c;
cout << "Enter three numbers: " << endl;
cin >> a >> b >> c;
if( (a*a + b*b == c*c) | | ( b*b + c*c == a*a ) | | ( c*c + a*a == b*b ) )
cout << "they are the sides of a right triangle" << endl;
else
cout << "they are NOT the sides of a right triangle" << endl;
system("PAUSE") ;
return 0;
}
4(a)
#include <iostream>
using namespace std;
int main()
{
int maximum=0,minimum=1,number,sum=0;
int count=0;
float average;
while(1)
{
cout<<"Enter a number(-1 to quit): "; cin>>number;
if(number==-1)
break; // enough asking for numbers
minimum=(number<minimum)?number:minimum;//condiitonal statement,
//if entered number is smaller than
our min,its new min
sum+=number; //add to sum
count++; // increment count
}
average=float(sum)/float(count);
int main() {
int n = 1, ten = 10, hundred = 100, thousand = 1000, a, b, c, d;
printf("N\t10*N\t100*N\t1000*N\n");
while ( n <= 10 ) {
printf("%d\t", n );
a = n * ten;
printf("%d\t", a );
b = n * hundred;
printf("%d\t", b );
c = n * thousand;
printf("%d\n", c );
n++;
}
return 0;
}
6(a)
#include <bits/stdc++.h>
// next term
k += 2;
}
}
// required sum
return sum;
}
// Driver program
int main()
{
int n = 5;
cout << "Sum = "
<< sumOfTheSeries(n);
return 0;
}