0% found this document useful (0 votes)
24 views7 pages

Hometask 06 New

Uploaded by

Aasif Rahaman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views7 pages

Hometask 06 New

Uploaded by

Aasif Rahaman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Assignment No : 06

Course No: CE 2208


Course Title: Sessional on Computer Programming

Submission Date: 17 October , 2023

Submitted To Submitted By:

Samsuddin Ahmed Mostasim Billah Toki


Lecturer Roll: 2001009
Department of Civil Engineering
Section: A
Khulna University of Engineering &
Technology (KUET) Session: 2021-22
Year: 2nd Term: 2nd
Classwork 01:

#include<stdio.h>
|C|
#include<string.h>
|CP|
main ()
|CPr|
{
|CPro|
int c,d,e;
|CProg|
char s[50]="CProgramming";
|CProgr|
for(c=0;c<=11;c++){
|CProgra|
d=c+1;
|CProgram|
e=c+1;
|CProgramm|
printf("|%-*.*s|\n",d,e,s);
|CProgrammi|
}
|CProgrammin|
for(c=11;c>=0;c--){
|CProgramming|
d=c+1;
|CProgramming|
e=c+1;
|CProgrammin|
printf("|%-*.*s|\n",d,e,s);
|CProgrammi|
}}
|CProgramm|

|CProgram|

|CProgra|

|CProgr|

|CProg|

|CPro|

|CPr|

|CP|

|C|
Classwork 02:

#include<stdio.h>

#include<string.h> Enter a string:

main () Mostasim

{ M

char str[20]; o

int i; s

printf("\nEnter a string:\n"); t

scanf("%s",str); a

for(i=0;str[i]!='\0';i=i+1){ s

printf("%c\n",str[i]); m

}}

Classwork 03:

#include<stdio.h>

#include<math.h> Enter the values of the number=

main(){ 4

int n; Enter the values of items=

printf("Enter the values of the number=\n"); 1234

scanf("%d",&n); 1.00 2.00 3.00 4.00

float a[n]; The sum=10.00

printf("Enter the values of items=\n"); The mean value=2.50

int i; Variance=1.25

for(i=0;i<n;i++) Standard Deviation=1.12

scanf("%f",&a[i]);

printf("%.2f\t",a[i]);

float sum,m,var1,var2,t=0,s;

for(i=0;i<n;i++){
sum=sum+a[i];

printf("\nThe sum=%.2f\n",sum);

m=sum/n;

printf("The mean value=%.2f",m);

for(i=0;i<n;i++)

var1=(pow((a[i]-m),2));

t=t+var1;

var2=t/n;

printf("\nVariance=%.2f\n",var2);

s=sqrt(var2);

printf("Standard Deviation=%.2f",s);

Multiplication of 2x2 mat(compile time ini.)

#include<stdio.h>
Matrix A is=
#include<math.h>
1 2
main ()
3 4
{

int a[2][2]={1,2,3,4};
Matrix B is=
int b[2][2]={5,6,7,8};
5 6
int c[2][2];
7 8
int i,j,k;

printf("Matrix A is=\n");
The multi. of mat A & mat B
for(i=0;i<2;i++)
19 22
{
43 50
for(j=0;j<2;j++)

printf("%d\t",a[i][j]);

printf("\n");

printf("\n");
printf("Matrix B is=\n");

for(i=0;i<2;i++)

for(j=0;j<2;j++)

printf("%d\t",b[i][j]);

printf("\n");

printf("\nThe multi. of mat A & mat B\n");

for(i=0;i<2;i++)

for(j=0;j<2;j++)

{ c[i][j]=0;

for(k=0;k<2;k++){

c[i][j]=c[i][j]+a[i][k]*b[k][j]; }

} for(i=0;i<2;i++)

for(j=0;j<2;j++)

printf("%d\t",c[i][j]);

printf("\n");

} }

Multiplication of 2x2 mat(run time ini.)

#include<stdio.h>

#include<math.h>

main ()

int a[2][2];

int b[2][2];
int c[2][2];

int i,j,k;

printf("Enter the values of mat A(2x2)");


Enter the values of mat A(2x2)
for(i=0;i<2;i++)
11 2 3 4
{
Matrix A is=
for(j=0;j<2;j++)
11 2
{
3 4
scanf("%d",&a[i][j]);

}
Enter the values of mat A(2x2)
}
5 1 9 12
printf("Matrix A is=\n");
Matrix B is=
for(i=0;i<2;i++)
5 1
{
9 12
for(j=0;j<2;j++)

{
The multi. of mat A & mat B
printf("%d\t",a[i][j]);
73 35
}
51 51
printf("\n");

printf("\n");

printf("Enter the values of mat A(2x2)\n");

for(i=0;i<2;i++)

for(j=0;j<2;j++)

scanf("%d",&b[i][j]);

printf("Matrix B is=\n");

for(i=0;i<2;i++)

for(j=0;j<2;j++)

printf("%d\t",b[i][j]);
}

printf("\n");

printf("\nThe multi. of mat A & mat B\n");

for(i=0;i<2;i++)

for(j=0;j<2;j++)

{ c[i][j]=0;

for(k=0;k<2;k++){

c[i][j]=c[i][j]+a[i][k]*b[k][j]; }

} for(i=0;i<2;i++)

for(j=0;j<2;j++)

printf("%d\t",c[i][j]);

printf("\n");

} }

You might also like