Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Green University of Bangladesh

Department of Computer Science and Engineering (CSE)


Faculty of Sciences and Engineering
Semester: (Summer, Year: 2022), B.Sc. in CSE (Day)

Course Title: Structured Programming Lab


Course Code: CSE-104 Section: DN

Lab Report Name: Lab Report-01

Student Details
Name ID

1. Md. Abu Saeid 221902092

Submission Date: 22 July 2022


Course Teacher’s Name: Mahbubur Rahman

[For Teachers use only: Don’t Write Anything inside this box]

Lab Report Status

Marks: ………………………………… Signature: .....................

Comments: .............................................. Date: ..............................


Task-01: Write a C program to check whether a number is
divisible by 5 and 11 or not.
#include <stdio.h>
int main(){
int num;

printf("Enter a number: ");


scanf("%d", &num);

if ((num % 5 == 0) && (num % 11 == 0)){


printf("%d is divisible by both 5 and 11.", num);
}
else{
printf("%d is not divisible by both 5 and 11.", num);
}
return 0;
}

Output:
Task-02: Write a C program to find maximum between three
numbers.

#include <stdio.h>

int main()
{
float a, b, c;

printf("Enter three numbers: \n");


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

if(a>b&&a>c)
{
printf("%.2f is Maximum.",a);
}
else if (b>a&&b>c)
{
printf("%.2f is Maximum",b);
}
else {
printf("%.2f is Maximum",c);
}
return 0;
}

Output:
Task-03: Write a Program to take the value from the user as input any alphabet and
check whether it is vowel or consonant (Using the switch statement).

#include <stdio.h>

int main()
{
char ch;

printf("Enter any alphabet: ");


scanf("%c", &ch);

if(ch>='a' && ch<='z' || ch>='A' && ch<='Z')


{

switch(ch)
{
case 'a':
printf("Vowel");
break;
case 'e':
printf("Vowel");
break;
case 'i':
printf("Vowel");
break;
case 'o':
printf("Vowel");
break;
case 'u':
printf("Vowel");
break;
case 'A':
printf("Vowel");
break;
case 'E':
printf("Vowel");
break;
case 'I':
printf("Vowel");
break;
case 'O':
printf("Vowel");
break;
case 'U':
printf("Vowel");
break;
default:
printf("Consonant");
}
}
else{
printf("This is not an alphabet",ch);
}
return 0;
}

Output 01:

Output 02:
Task 04: Write a C program to check whether a year is leap
year or not.

#include <stdio.h>

int main()
{
int yr;
printf ("Enter a year: ");
scanf ("%d", &yr);
if (yr%4 == 0 && yr%100 == 0 && yr%400 == 0)
printf("\n It is LEAP YEAR.",yr);

else if (yr%4==0 && yr%100!=0)


printf("\n %d is a LEAP YEAR.",yr);
else
printf ("\n %d is NOT a LEAP YEAR.",yr);
return 0;
}

Output:

You might also like