Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

1. #include <stdio.

h>

int main()

int a, b;

printf("Enter 2 numbers: ");

scanf("%d%d", &a, &b);

if (a > b)

printf("The first number is greater than the second number");

else

printf("The second number is greater than the first number");

return 0;

2. #include<stdio.h>

int main()

int a, b;

printf("Enter 2 numbers: ");

scanf("%d%d", &a, &b);

if (a>b)

printf("%d - max, %d - min", a, b);

else

printf("%d - max, %d - min", b, a);


}

return 0;

3. #include<stdio.h>

int main()

int a, b;

printf("Enter two distances (in km and in feet): ");

scanf("%d%d", &a, &b);

b=b*0.45;

if (a>b)

printf("Distance in km greater");

else

printf("Distance in feet greater");

return 0;

4. #include <stdio.h>

int main()

int r, s, squa, circ;

printf("Enter the radius of the circle and the side of the square: ");

scanf("%d%d", &r, &s);

circ=3.14*r*r;

squa=s*squa;

if (circ>squa)
{

printf("The area of the circle is greater ");

else

printf("The area of the square is greater");

return 0;

5. #include <stdio.h>

int main ()

int m1, y1, m2=10, y2=2022, x, y;

printf("Enter date of birth (number of month and year): ");

scanf("%d%d", &m1, &y1);

m1=m1+y1*12;

m2=m2+y2*12;

x=m2-m1;

y1=x/12;

printf("Person's age %d", y1);

return 0;

You might also like