Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
67 views29 pages

Lab Report

Uploaded by

webd892
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)
67 views29 pages

Lab Report

Uploaded by

webd892
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/ 29

Lab Report

Course Code: CSE114


Course Title: Programming & Problem Solving Lab
Submitted By:

Name: Kazi Abir Hasan


ID: 0242310005101213
Section: 64_L
Department: CSE
Daffodil International University

Submitted To:
Md. Ferdous Ahmed Foysal
Lecturer
Department of CSE

Date of submission: 13-03-2023


1000
#include <stdio.h>
int main() {
printf("Hello World!\n");

return 0;
}

1001
#include <stdio.h>

int main() {

int A,B,X;
scanf("%d %d", &A,&B);

X=A+B;
printf("X = %d\n",X);

return 0;
}

1002
#include <stdio.h>
int main() {
double R, A, PI=3.14159;
scanf("%lf", &R);
A = PI * R * R;
printf("A=%.4lf\n", A);
return 0;
}
1003

#include <stdio.h>

int main() {

int A,B,SOMA;
scanf("%d %d", &A, &B);

SOMA=A+B;
printf("SOMA = %d\n", SOMA);

return 0;
}

1004

#include <stdio.h>

int main() {

int A,B,PROD;
scanf("%d %d", &A, &B);

PROD=A*B;
printf("PROD = %d\n", PROD);

return 0;
}
1007

#include <stdio.h>
int main() {

int A,B,C,D, x;
scanf("%d %d %d %d", &A, &B, &C, &D);

x=A*B-C*D;

printf("DIFERENCA = %d\n", x);

return 0;
}

1008
#include <stdio.h>

int main() {

int a, b;

float d,c;

scanf("%d %d %f", &a, &b, &c);

d=b*c;

printf("NUMBER = %d\n", a);

printf("SALARY = U$ %0.2f\n", d);

return 0;

}
1009
#include<stdio.h>
int main()
{
double x,y,a;
char k;
scanf("%s %lf %lf", &k, &x, &y);
a=(x+(y*0.15));
printf("TOTAL = R$ %0.2lf\n", a);
return 0;
}

1010
#include <stdio.h>

int main() {

int a, b, c, d;
float e, f, g, h, total;

scanf("%d %d %f", &a, &b, &e);

scanf("%d %d %f", &c, &d, &f);

g=b*e;
h=d*f;

total=g+h;

printf("VALOR A PAGAR: R$ %0.2f\n", total);

return 0;
}
1011
#include <stdio.h>
int main() {
double pi=3.14159, R, V;
scanf("%lf", &R);

V=(4.0/3.0)*pi*R*R*R;

printf("VOLUME = %0.3lf\n", V);


return 0;
}

1012
#include <stdio.h>
int main() {
double A, B, C;
double D, E, F, G, H;
double pi=3.14159;
scanf("%lf %lf %lf", &A, &B, &C);
D=0.5*A*C;
E=pi*C*C;
F=0.5*(A+B)*C;
G=B*B;
H=A*B;
printf( "TRIANGULO: %0.3lf\n"
"CIRCULO: %0.3lf\n"
"TRAPEZIO: %0.3lf\n"
"QUADRADO: %0.3lf\n"
"RETANGULO: %0.3lf\n", D, E, F,G, H);
return 0;
}
1014
#include <stdio.h>
int main() {
int a;
float b, total;
scanf("%d %f", &a, &b);
total=a/b;
printf("%0.3f km/l\n", total);
return 0;
}

1015
#include <stdio.h>

int main() {

int a;
float b, total;

scanf("%d %f", &a, &b);

total=a/b;
printf("%0.3f km/l\n", total);

return 0;
}
1016
#include <stdio.h>

int main() {

int a, b;
scanf("%d", &a);
b=a*2;

printf("%d minutos\n", b);


return 0;
}

1017
#include <stdio.h>
int main() {

int v, t;
float s, total;

scanf("%d %d", &t, &v);

s=v*t;
total=s/12;

printf("%0.3f\n", total);

return 0;
}

1043

#include <stdio.h>

int main() {
float a, b,c, x, y;
scanf("%f %f %f", &a, &b, &c);

if((a+b)>c && (a+c)>b && (b+c)>a)


{
x=a+b+c;
printf("Perimetro = %0.1f\n", x);
}
else{
y=((a+b)/2)*c;
printf("Area = %0.1f\n", y);
}

return 0;
}

1038

#include <stdio.h>

int main()
{
int x, y;
float total, z;
scanf("%d %d", &x, &y);

if(x==1)
{
z=4;
}
else if(x==2)
{
z=4.5;
}
else if(x==3)
{
z=5;
}
else if(x==4)
{
z=2;
}
else if(x==5)
{
z=1.5;
}

total=z*y;
printf("Total: R$ %0.2f\n", total);

return 0;
}

1043
#include <stdio.h>

int main() {

float a, b,c, x, y;
scanf("%f %f %f", &a, &b, &c);

if((a+b)>c && (a+c)>b && (b+c)>a)


{
x=a+b+c;
printf("Perimetro = %0.1f\n", x);
}
else{
y=((a+b)/2)*c;
printf("Area = %0.1f\n", y);
}

return 0;
}
1044
#include <stdio.h>

int main() {

int a, b,i;
scanf("%d %d", &a, &b);
if(b%a==0 || a%b==0)
{
printf("Sao Multiplos\n");
}
else{
printf("Nao sao Multiplos\n");
}

return 0;
}

1048

#include <stdio.h>

int main(){
float a, x=0,y=0;
scanf("%f", &a);
if(a>0 && a<=400)
{
x=a*0.15;
y=a+x;

printf("Novo salario: %0.2f\n"


"Reajuste ganho: %0.2f\n"
"Em percentual: 15 %%\n", y, x);
}
if(a>400 && a<=800)
{
x=a*0.12;
y=a+x;

printf("Novo salario: %0.2f\n"


"Reajuste ganho: %0.2f\n"
"Em percentual: 12 %%\n", y, x);
}
if(a>800 && a<=1200)
{
x=a*0.10;
y=a+x;

printf("Novo salario: %0.2f\n"


"Reajuste ganho: %0.2f\n"
"Em percentual: 10 %%\n", y, x);
}
if(a>1200 && a<=2000)
{
x=a*0.07;
y=a+x;

printf("Novo salario: %0.2f\n"


"Reajuste ganho: %0.2f\n"
"Em percentual: 7 %%\n", y, x);
}
if(a>2000)
{
x=a*0.04;
y=a+x;

printf("Novo salario: %0.2f\n"


"Reajuste ganho: %0.2f\n"
"Em percentual: 4 %%\n", y, x);
}

return 0;

}
1050
#include <stdio.h>
int main()
{
int x;
scanf("%d", &x);

if(x==61)
{
printf("Brasilia\n");
}
else if(x==71)
{
printf("Salvador\n");
}
else if(x==11)
{
printf("Sao Paulo\n");
}
else if(x==21)
{
printf("Rio de Janeiro\n");
}
else if(x==32)
{
printf("Juiz de Fora\n");
}
else if(x==19)
{
printf("Campinas\n");
}
else if(x==27)
{
printf("Vitoria\n");
}
else if(x==31)
{
printf("Belo Horizonte\n");
}
else{
printf("DDD nao cadastrado\n");
}

return 0;
}

1052
#include <stdio.h>

int main()
{
int x;
scanf("%d", &x);

switch (x)
{
case 1:
printf("January\n");
break;
case 2:
printf("February\n");
break;
case 3:
printf("March\n");
break;
case 4:
printf("April\n");
break;
case 5:
printf("May\n");
break;
case 6:
printf("June\n");
break;
case 7:
printf("July\n");
break;
case 8:
printf("August\n");
break;
case 9:
printf("September\n");
break;
case 10:
printf("October\n");
break;
case 11:
printf("November\n");
break;
case 12:
printf("December\n");
break;
}

return 0;
}

1067
#include<stdio.h>
int main()
{
int x, i;
scanf("%d", &x);
for(i=1; i<=x; i++)
{
if(i%2==1)
{
printf("%d\n", i);
}
}
return 0;
}
1071
#include<stdio.h>
int main()
{
int x, y, sum = 0, i;
int min, max;

scanf("%d %d", &x, &y);

if(x < y){


min = x;
max = y;
}else{
max = x;
min = y;
}

for(i = (min + 1); i < max; ++i)


{
if(i % 2 != 0){
sum += i;
}
}

printf("%d\n", sum);

return 0;
}

1074
#include <stdio.h>
int main()
{
int n,x,i;
scanf ("%d", &n);
for(i=1; i<=n; i++)
{
scanf ("%d",&x);
if(x==0)
printf("NULL\n");
else if(x<=0 && x%2==0)
printf ("EVEN NEGATIVE\n");
else if(x<=0 && x%2==-1)
printf ("ODD NEGATIVE\n");
else if(x>=0 && x%2==0)
printf ("EVEN POSITIVE\n");
else if(x>=0 && x%2==1)
printf ("ODD POSITIVE\n");
}
return 0;
}

1101
#include <stdio.h>

int main(){

int n;
int x, y, aux;
int sum;

while(1){

scanf("%d %d",&x, &y);


if(x <= 0) break;
if(y <= 0) break;

if(x > y){


aux = x;
x = y;
y = aux;
}
sum = 0;
for(int i = x; i <= y; i++){
printf("%d ",i);
sum += i;
}
printf("Sum=%d\n",sum);

}
return 0;
}

1113
#include<stdio.h>
int main()
{
int x=0, y=0, i;

for(i=1; i; i++)
{
scanf("%d %d", &x, &y);

if(x==y)
break;

else{
if(x<y)
{
printf("Crescente\n");
}
else{
printf("Decrescente\n");
}
}
}

return 0;
}
1114
#include<stdio.h>
int main()
{
int x=0, i;
for(i=1; i; i++)
{
scanf("%d", &x);

if(x==2002)
{
printf("Acesso Permitido\n");
break;
}
else{
printf("Senha Invalida\n");
}
}

return 0;
}

1116
#include<stdio.h>
int main()
{
int n, i;
float sum=0, x, y;
scanf("%d", &n);

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


{
scanf("%f %f", &x, &y);

if(y==0)
{
printf("divisao impossivel\n");
}

else{
sum=x/y;
printf("%0.1f\n", sum);
}
}

return 0;
}

1134
#include <stdio.h>
int main()
{
int a, x=0, y=0, z=0;
while(1)
{
scanf("%d", &a);
if(a==4)
break;
else
{
if(a==1) x++;
else if(a==2) y++;
else if(a==3) z++;
else continue;
}
}
printf("MUITO OBRIGADO\n");
printf("Alcool: %d\n",x);
printf("Gasolina: %d\n",y);
printf("Diesel: %d\n",z);
return 0;
}
1151
#include<stdio.h>
int main(){
int N,i,n[100];
scanf("%d", &N);

n[0] = 0;
n[1] = 1;

for(i = 2; i < N; i++){


n[i] = n[i-1] + n[i-2];
}
printf("0");
for(i = 1; i < N; i++){
printf(" %d", n[i]);
}
printf("\n");
return 0;
}

1180
#include <stdio.h>
int main()
{
int a,b,c,d,e,N, p, min;
scanf("%d", &N);
int X[N];
for(a=0; a<N; a++)
scanf("%d", &X[a]);
min=X[0];
for(a=1; a<N; a++)
{
if(min>X[a])
{
min=X[a];
p=a;
}
}
printf("Menor valor: %d\nPosicao: %d\n", min, p);
return 0;
}

1985
#include <stdio.h>

int main()
{
int b, i, p;
float a, sum;
scanf("%d", &p);
for(i=1; i<=p; i++)
{
scanf("%f %d", &a, &b);
if(a==1001)
a=1.50;
if(a==1002)
a=2.50;

if(a==1003)
a=3.50;

if(a==1004)
a=4.50;

if(a==1005)
a=5.50;
sum=sum+(a*b);
}
printf("%0.2f\n", sum);
return 0;
}
2456
#include <stdio.h>

int main()
{
int a, b, c, d, e;
scanf("%d %d %d %d %d", &a, &b, &c, &d, &e);

if(a<b && a<c && a<d && a<e &&


b<c && b<d && b<e &&
c<d && c<e &&
d<e)
{
printf("C\n");
}
else if(a>b && a>c && a>d && a>e &&
b>c && b>d && b>e &&
c>d && c>e &&
d>e)
{
printf("D\n");
}
else{
printf("N\n");
}

return 0;
}
2747
#include<stdio.h>
int main()
{
printf("---------------------------------------\n");
printf("| |\n");
printf("| |\n");
printf("| |\n");
printf("| |\n");
printf("| |\n");
printf("---------------------------------------\n");

return 0;
}

2748
#include<stdio.h>
int main() {
printf("---------------------------------------\n");
printf("| Roberto |\n");
printf("| |\n");
printf("| 5786 |\n");
printf("| |\n");
printf("| UNIFEI |\n");
printf("---------------------------------------\n");

return 0;
}

2754
#include<stdio.h>
int main()
{
printf("234.345000 - 45.698000\n");
printf("234 - 46\n");
printf("234.3 - 45.7\n");
printf("234.34 - 45.70\n");
printf("234.345 - 45.698\n");
printf("2.343450e+02 - 4.569800e+01\n");
printf("2.343450E+02 - 4.569800E+01\n");
printf("234.345 - 45.698\n");
printf("234.345 - 45.698\n");

return 0;
}

2757
#include <stdio.h>

int main ()
{

int a, b, c;

scanf("%d %d %d", &a, &b, &c);

printf("A = %d, B = %d, C = %d\n", a, b, c);


printf("A = %10d, B = %10d, C = %10d\n", a, b, c);
printf("A = %010d, B = %010d, C = %010d\n", a, b, c);
printf("A = %-10d, B = %-10d, C = %-10d\n", a, b, c);

return 0;

}
2762

#include <stdio.h>

int main() {

int a, b;
char x;
scanf("%d%c%d\n", &a, &x, &b);

printf("%d%c%d\n", b, x, a);

return 0;
}

2763
#include <stdio.h>

int main() {

int a, b, c, d;
char x, y;
scanf("%d%c%d%c%d%c%d", &a, &x, &b, &x, &c, &y, &d);

printf("%03d\n%03d\n%03d\n%02d\n", a, b, c, d);

return 0;
}
2764
#include <stdio.h>

int main() {

int a, b, c;
char x;

scanf("%d%c%d%c%d", &a, &x, &b, &x, &c);


printf("%02d/%02d/%02d\n", b, a, c);
printf("%02d/%02d/%02d\n", c, b, a);
printf("%02d-%02d-%02d\n", a, b, c);

return 0;
}

2787
#include <stdio.h>
int main()
{
int l, c, x;
scanf("%d %d", &l, &c);
if(l%2==0 && c%2==0)
{
x=1;
}
else if(l%2==1 && c%2==1)
{
x=1;
}
else{
x=0;
}
printf("%d\n", x);
return 0;
}
2987

#include <stdio.h>

int main()
{
char ch;
int i, j;
scanf("%c", &ch);

for(i=1, j=65; i<=26; i++, j++)


{
if(ch==j)
{
break;
}
}
printf("%d\n", i++);

return 0;
}

You might also like