0% found this document useful (0 votes)
22 views19 pages

Lab Report 1EEE134.6

Uploaded by

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

Lab Report 1EEE134.6

Uploaded by

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

Azharul Islam

ID:2021200510011
Course Code: EEE134.6
Lab Report – 1
Batch:12th
Ans. to the Qus.No1

(a)
Picture: Code

Output;1
Output:2

Output:3

Output:4
Code:
#include <stdio.h>
void main ()
{
char gender;
float gpa_SSC, gpa_HSC;

printf ("Enter Info : Gender,GPA(SSC),GPA(HSC)");


scanf("%c %f %f",&gender, &gpa_SSC,&gpa_HSC);

if(5<gpa_SSC||5<gpa_HSC)
printf("Wrong Input");

else if (gender=='M' && (gpa_SSC==5.0 && gpa_HSC>=4.8))


printf ("Eligible for Scholarship");

else if (gender=='F' && (gpa_SSC>=4.5 || gpa_HSC>=4.5))


printf ("Eligible for Scholarship");
else
printf("Not Eligible for Scholarship");
}

(b)(i)
# if

Code:
#include <stdio.h>
int main()
{
int day;
printf("Enter Input : ");
scanf("%d",&day);
if(day==1){
printf("Saturday");
}
if(day==2){
printf("Sunday");
}
if(day==3){
printf("Monday");
}
if(day==4){
printf("Tuesday");
}
if(day==5){
printf("Wednesday");
}
if(day==6){
printf("Thursday");
}
if(day==7){
printf("Friday");
}
if(day<0||day>7){
printf("Wrong Input");
}
}
(b-ii)
#else if

Code:
#include <stdio.h>
int main()
{
int day;
printf("Enter Intput : ");
scanf("%d",&day);
if(day==1){
printf("Saturday");
}
else if(day==2){
printf("Sunday");
}
else if(day==3){
printf("Monday");
}
else if(day==4){
printf("Tuesday");
}
else if(day==5){
printf("Wednesday");
}
else if(day==6){
printf("Thursday");
}
else if(day==7){
printf("Friday");
}
else{
printf("Wrong Input");
}
}
(b-iii)
# switch

Code:
#include <stdio.h>
int main()
{
int day;
printf("Enter Input : ");
scanf("%d",&day);

switch(day)
{
case 1: printf ("Saturday\n") ;
break ;
case 2: printf ("Sunday\n") ;
break ;
case 3: printf ("Monday\n") ;
break ;
case 4: printf ("Tuesday\n") ;
break ;
case 5: printf ("Wednesday\n") ;
break ;
case 6: printf ("Thursday\n") ;
break ;
case 7: printf ("Friday\n") ;
break ;
default: printf ("Wrong Input\n");
}

Ans(c)

# Series Calculation

Code:
#include<stdio.h>

int main()
{
int i,n=7,sum=0;
for(i=1;i<=n;i++)
{
sum=sum+i*i;
}
printf("Value of sum:%d",sum);

Ans(d)
Picture:

Code:
#include<stdio.h>
int main ()
{
int match1,match2,match3,match4,match5;
float avag;
printf("Enter five match runs : ");
scanf("%d %d %d %d
%d",&match1,&match2,&match3,&match4,&match5);
avag=(match1+match2+match3+match4+match5)/(float)
5;
printf("Average Runs : %.2f \n ",avag);

if(avag>=71){
printf("Excellent Batsman");
}
else if(avag<=70&&avag>=51){
printf("Good Batsman");
}
else if(avag<=50&&avag>=35){
printf("Average Batsman");
}
else if(avag<35){
printf("Ordinary Batsman");
}
}
Ans.(e)
Picture:
Code:
#include<stdio.h>
int main()
{
int Bday = 15;
int Bmonth = 11;
int Byear = 1999;
int Tday=22;
int Tmonth=04;
int Tyear=2022;

if( Tday>=Bday)
{
Tday-=Bday;
}
else
{
Tmonth--;
Tday+=30;
Tday-=Bday;
}
if(Tmonth>=Bmonth)
{
Tmonth-=Bmonth;
}
else
{
Tyear--;
Tmonth+=12;
Tmonth-=Bmonth;
}
Tyear-=Byear;
printf("Your Present Age is : \n");
printf("\t%d Year \n",Tyear);
printf("\t%d Month \n",Tmonth);
printf("\t%d Day \n",Tday);
return 0;
}
Ans.to the Qus No:2
(a)
Picture:

Code:
#include <stdio.h>
int main()
{
int i;
for (i=19; i<=35; i=i+3)
{
if (i%2 == 0)
printf ("%d ", i);
}
}
(b)
Picture:
Code:
#include<stdio.h>
void main()
{
int n=71285,i=4,mod,result=0;
while (n>0)
{
mod = n %10;
n = n /10;
result = result + mod * pow(10,i);
i--;
}
printf ("%d",result);
}

You might also like