Lab Manual: Report: Lab 2 "Computer Fundamentals"
Lab Manual: Report: Lab 2 "Computer Fundamentals"
Grading Criteria
Marks 51 – 60 D
Marks 61 – 70 C
Marks 71 – 80 B
Marks 81 – 100 A
Sample Output-1
Enter the marks: 80
Grade: A
CODE:
#include <stdio.h>
int main()
{
float marks;
printf ("Enter the marks: ");
scanf ("%f",&marks);
if (marks>=81&&marks<=100)
printf("Grade:A");
else if(marks>=71&&marks<=80)
printf("Grade:B");
else if (marks>=61&&marks<=70)
printf("Grade:C");
else if (marks>=51&&marks<=60)
printf("Grade:D");
else
printf("Invalid input");
getchar();getchar();
return 0;
}
Here is shown the screenshot of the above program and its executable file.
1|Page
Here is shown the executable file of the above program.
2|Page
Lab Task -02
Write a program that allow user to enter the day of the week as integer value e.g. for Monday the
user can enter 1, for Sunday user can enter 7.
The program should print the name of the day by using this integer value
Code:
#include <stdio.h>
int main()
int day;
printf ("Enter the day of the week as integer value e.g., 1 for Monday:
");
scanf ("%d",&day);
switch (day)
case (1):
printf ("Monday");
break;
case (2):
printf ("Tuesday");
break;
case (3):
printf ("Wednesday");
break;
case (4):
printf ("Thursday");
break;
3|Page
case (5):
printf ("Friday");
break;
case (6):
printf ("Satday");
break;
case (7):
printf ("Sunday");
break;
default:
getchar();getchar();
return 0;
4|Page
Here is shown the screenshot of the above program and its executable file.
5|Page
Here is shown the executable file of the above program.
6|Page