Labsheet 5
Labsheet 5
Labsheet 5
#include <stdio.h>
int main(){
int n;
scanf("%d", &n);
switch(n){
case 1 : printf("Monday");
break;
case 2 : printf("Tueday");
break;
case 3 : printf("Wednesday");
break;
case 4 : printf("Thursday");
break;
case 5 : printf("Friday");
break;
case 6 : printf("Saturday");
break;
case 7 :
printf("Sunday");
break;
default:
return 0;
}
Qn 2
#include <stdio.h>
int main(){
int age;
scanf("%d", &age);
return 0;
}
Qn 3
#include <stdio.h>
int main(){
//largest no in a
//second largest in b
if(b>a){
a = a+b;
b = a-b;
a = a-b;
if(c>a){
a = a+c;
c = a-c;
a = a-c;
if(d>a){
a = a+d;
d = a-d;
a = a-d;
if(d>b){
return 0;
}
Qn 4
#include <stdio.h>
int main(){
int n;
scanf("%d", &n);
int i=1;
while(i<=n){
printf("%d\n", i);
i++;
printf("Bye\n");
return 0;
}
Qn 6
#include <stdio.h>
int main(){
int n;
scanf("%d", &n);
//spaces
printf(" ");
if(i==1){
printf("*");
//star
printf("*");
//spaces
printf(" ");
}
//star
printf("*");
if(i==n){
printf("*");
printf("\n");
return 0;