Lab Report 01
Lab Report 01
Student Details
Name ID
[For Teachers use only: Don’t Write Anything inside this box]
Output:
Task-02: Write a C program to find maximum between three
numbers.
#include <stdio.h>
int main()
{
float 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;
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);
Output: