Bachelor of Technology in Information Technology



Download 0,65 Mb.
bet11/14
Sana20.03.2022
Hajmi0,65 Mb.
#502184
1   ...   6   7   8   9   10   11   12   13   14
Bog'liq
PSP Lab Manual

SOURCE CODE:


#include #include void main()


{
int array[100], n, c, d, swap; printf("Enter number of elements\n"); scanf("%d", &n);
printf("Enter %d integers\n", n);

for (c = 0; c < n; c++) scanf("%d", &array[c]); for (c = 0 ; c < n - 1; c++)


{
for (d = 0 ; d < n - c - 1; d++)
{
if (array[d] > array[d+1]) /* For decreasing order use < */
{
swap = array[d]; array[d] = array[d+1]; array[d+1] = swap;
}
}
}
printf("Sorted list in ascending order:\n"); for (c = 0; c < n; c++)
printf("%d\n", array[c]); getch();
}------------------------------*-----------OUTPUT----------------*------------------------




  1. Matrix Addition/ Subtraction ALGORITHM:


Step 1: Start.
Step 2: declare m, n, I, j, a[10][10], b[10][10], c[10][10] Step 3: print enter size of matrix
Step 4: read m, n.
Step 5: print enter the values into the first matrix Step 6: repeat step until i less than m and j less than n
read a[i][j]
Step 7: print entered matrix is

Step 8: repeat step until i less than m and j less than n Print a[i][j]


Step 9: print enter the values into second matrix
Step 10: repeat step until i less than m and j less than n read b[i][j]
Step 11: print entered matrix is
Step 12: repeat step until i less than m and j less than n print b[i][j]
Step 13: repeat step until i less than m and j less than n Step 14: c[i][j] ← a[i][j]+b[i][j]
Step 15: print resultant matrix after addition is
Step 16: repeat step until i less than m and j less than n Step 17: print c[i][j]
Step 18: Stop.


SOURCE CODE:


#include #include int main()


{
Int m,n, i, j;
int a[10][10],b[10][10],c[10][10];
printf("Enter the size of the matrix \n"); scanf("%d%d",&m, &n);
printf("enter the values into the first matrix \n"); for(i=0;i{
for(j=0;j{
scanf("%d", &a[i][j]);
}
}
printf("The matrix entered is \n");

for(i=0;i
{
for(j=0;j{
printf("%d ", a[i][j]);
}
printf("\n");
}

printf("enter the values into the second matrix \n"); for(i=0;i
{
for(j=0;j{
scanf("%d", &b[i][j]);
}
}
printf("The matrix entered is \n");

for(i=0;i
{
for(j=0;j{
printf("%d ", b[i][j]);
}
printf("\n");
}
//matrix addition

for(i=0;i
{
for(j=0;j{
c[i][j] = a[i][j]+b[i][j];
}
}

printf("The resultant matrix after addition is \n");


for(i=0;i
{
for(j=0;j{
printf("%d ", c[i][j]);
}
printf("\n");
}
getch();
}
------------------------------*-----------OUTPUT----------------*------------------------



  1. Download 0,65 Mb.

    Do'stlaringiz bilan baham:
1   ...   6   7   8   9   10   11   12   13   14




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish