You are on page 1of 3

Group name - sw-924-1

Name Zayahuu
1)

#include <stdio.h>
int main()
{
int a ;
scanf("%d", &a);
switch(a)
{
case 1:
{
printf("Monday");
break;
}
case 2:
{
printf("Tuesday");
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;
}
}

2)

#include <stdio.h>
main()
{
int a[5], smallestNumber = 1, largestNumber = 1;
for(int i = 1; i <=5; i++)
{
scanf("%d", &a[i]);

if(smallestNumber >= a[i])


{
smallestNumber = a[i];
}

if(largestNumber < a[i])


{
largestNumber = a[i];
}

printf("smallestNumber is = %d \n", smallestNumber);


printf("largestNumber is = %d", largestNumber);
}

3)

#include <stdio.h>
#include <conio.h>
main()
{
// declare the local variables
int i, j, rows, k, m = 1;

printf("\n");

for ( i = 5; i >= 1; i--)


{

for ( j = 1; j <= m; j++)


{
printf (" ");
}

for ( k = 1; k <= ( 2 * i - 1); k++)


{
printf ("* ");
}
m++;
printf ("\n");
}
getch();
}

4)

5)
#include <iostream>
#include <math.h>
using namespace std;
int main() {
int a, n, b, c, d, e, i;
cin>>a;
c=a;
n=1;
d=0;
e=0;
i=0;
while(c>9) {
c=c/10;
n=n*10;
e=e+1;
}
while(a>0) {
b=a%10;
d=b*(n/pow(10,i))+d;
i=i+1;
a=a/10;
}
cout<<d;

return 0;
}

6)

#include <stdio.h>

int main()
{
int x, y, *a, *b, temp;

printf("Enter the value of x and y\n");


scanf("%d%d", &x, &y);

printf("Before Swapping\nx = %d\ny = %d\n", x, y);

a = &x;
b = &y;

temp = *b;
*b = *a;
*a = temp;

printf("After Swapping\nx = %d\ny = %d\n", x, y);

return 0;
}

You might also like