Write A Programme To Find The Transpose of A Two Dimensional Matrix
Write A Programme To Find The Transpose of A Two Dimensional Matrix
}
cout<<"\nfactorial of "<<x<<" is:"<<f;
getch();
return;
}
Output:
enter the no. whose factorial is to be found:6
factorial of 6 is:720
case 2
enter the string:
asdfghhkltrjyj
it is not a palindrome
a[j]=s;
}
cout<<"\n\ndetails of the students in sorted form is....\n\n";
for(i=0;i<10;i++)
{
cout<<"name:"<<a[i].name;
cout<<"\nage:"<<a[i].age;
for(int j=0;j<5;j++)
cout<<"\nsubject "<<j+1<<":"<<a[i].mark[j];
cout<<"\ntotal mark:"<<a[i].t<<"\n\n";
}
getch();
return;
}
Output:
enter the details.......
details of student 1
enter the name:st1
enter age:17
enter the marks:
subject 1:45
subject 2:75
subject 3:86
subject 4:76
subject 5:61
details of student 2
enter the name:st2
enter age:17
enter the marks:
subject 1:56
subject 2:68
subject 3:67
subject 4:61
subject 5:78
7
details of student 3
enter the name:st3
enter age:18
enter the marks:
subject 1:78
subject 2:98
subject 3:89
subject 4:44
subject 5:46
details of student 4
enter the name:st4
enter age:19
enter the marks:
subject 1:98
subject 2:99
subject 3:97
subject 4:96
subject 5:95
details of student 5
enter the name:st5
enter age:17
enter the marks:
subject 1:54
subject 2:45
subject 3:51
subject 4:54
subject 5:50
details of student 6
enter the name:st6
enter age:18
enter the marks:
subject 1:74
subject 2:73
8
subject 3:72
subject 4:71
subject 5:69
details of student 7
enter the name:st7
enter age:17
enter the marks:
subject 1:97
subject 2:45
subject 3:68
subject 4:70
subject 5:80
details of student 8
enter the name:st8
enter age:19
enter the marks:
subject 1:55
subject 2:65
subject 3:67
subject 4:88
subject 5:81
details of student 9
enter the name:st9
enter age:18
enter the marks:
subject 1:81
subject 2:84
subject 3:87
subject 4:85
subject 5:40
details of student 10
enter the name:st10
enter age:17
9
name:st4
age:19
subject 1:98
subject 2:99
subject 3:97
subject 4:96
subject 5:95
total mark:485
name:st9
age:18
subject 1:81
subject 2:84
subject 3:87
subject 4:85
subject 5:40
total mark:377
name:st7
age:17
subject 1:97
subject 2:45
subject 3:68
subject 4:70
subject 5:80
total mark:360
name:st10
10
age:17
subject 1:78
subject 2:65
subject 3:70
subject 4:60
subject 5:90
total mark:363
name:st6
age:18
subject 1:74
subject 2:73
subject 3:72
subject 4:71
subject 5:69
total mark:359
name:st8
age:19
subject 1:55
subject 2:65
subject 3:67
subject 4:88
subject 5:81
total mark:356
name:st3
age:18
subject 1:78
subject 2:98
subject 3:89
subject 4:44
subject 5:46
total mark:355
name:st1
age:17
11
subject 1:45
subject 2:75
subject 3:86
subject 4:76
subject 5:61
total mark:343
name:st2
age:17
subject 1:56
subject 2:68
subject 3:67
subject 4:61
subject 5:78
total mark:330
name:st5
age:17
subject 1:54
subject 2:45
subject 3:51
subject 4:54
subject 5:50
total mark:254
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n;
cout<<"enter the value of n:";
cin>>n;
cout<<"the reduired dimond is\n\n";
for(int i=1;i<=n;i++)
{
for(int j=0;j<n-i;j++)
cout<<" ";
for(j=1;j<2*i;j++)
cout<<"*";
cout<<"\n";
}
i--;
for(i=n-1;i>0;i--)
{
for(int j=0;j<n-i;j++)
cout<<" ";
for(j=1;j<2*i;j++)
cout<<"*";
cout<<"\n";
}
getch();
return;
}
13
Output:
*
***
*****
*******
*********
***********
*************
***************
*************
***********
*********
*******
*****
***
*
7.Write a programme to delete duplicates in a given vector and print
resultant vector…
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a[100],n;
cout<<"enter the limit:";
cin>>n;
cout<<"enter the array:\n";
for(int i=0;i<n;i++)
cin>>a[i];
for(i=0;i<n-1;i++)
for(int j=i+1;j<n;j++)
if(a[i]==a[j])
{
for(int k=j;k<n-1;k++)
a[k]=a[k+1];
n--;
14
}
cout<<"the resultant array is:\n";
for(i=0;i<n;i++)
cout<<a[i]<<" ";
getch();
return;
}
Output:
enter the limit:10
enter the array:
7
6
8
5
7
9
4
3
9
1
the resultant array is:
7 6 8 5 9 4 3 1