MRNG Day 01

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

DAY 1

17 April 2024 08:34 AM


#include <stdio.h>
int main()
{
int a,b,sum;
printf("Enter 2 number:");
scanf("%d%d",&a,&b);
sum=a+b;
printf("Sum = %d",sum);
return 0;
}
#include <stdio.h>
int main()
{
int a,b,sum;
printf("Enter 2 number:");
scanf("%d%d",&a,&b);
sum = printf("%*c%*c",a,' ',b,' ');
printf("\rSum = %d",sum);
return 0;
}

#include <stdio.h>
int main()
{
int a,b,temp;
printf("Enter 2 number:");
scanf("%d%d",&a,&b);
temp = a;
a=b;
b=temp;
printf("%d %d",a,b);
return 0;
}
#include <stdio.h>
int main()
{
int a,b;
printf("Enter 2 number:");
scanf("%d%d",&a,&b);
a=a+b;
b=a-b;
a=a-b;
printf("%d %d",a,b);
return 0;
}
#include <stdio.h>
int main()
{
int n,a,b,c,sum;
printf("Enter a number:");
scanf("%d",&n);
a=n%10;
n=n/10;
b=n%10;
c=n/10;
sum=a+b+c;
printf("%d",sum);
return 0;
}

#include <stdio.h>
int main()
{
int n,a,b,c,rev;
printf("Enter a number:");
scanf("%d",&n);
a=n%10;
n=n/10;
b=n%10;
c=n/10;
rev=a*100+b*10+c;
printf("%d",rev);
return 0;
}
#include <stdio.h>
int main()
{
int a,b;
printf("Enter 2 numbers:");
scanf("%d%d",&a,&b);
if(a>b)
printf("%d",a);
else
printf("%d",b);
return 0;
}
#include <stdio.h>
int main()
{
int a,b,c,max;
printf("Enter 3 numbers:");
scanf("%d%d%d",&a,&b,&c);
if(a>b)
{
if(a>c)
max=a;
else
max=c;
}
else
{
if(b>c)
max=b;
else
max=c;
}
printf("%d",max);
return 0;
}

#include <stdio.h>
int main()
{
int a,b,c,d,max;
printf("Enter 4 numbers:");
scanf("%d%d%d%d",&a,&b,&c,&d);
if(a>b)
{
if(a>c)
{
if(a>d)
max=a;
else
max=d;
}
else
{
if(c>d)
max=c;
else
max=d;
}
}
else
{
if(b>c)
{
if(b>d)
max=b;
else
max=d;
}
else
{
if(c>d)
max=c;
else
max=d;
}
}
printf("%d",max);
return 0;
}

You might also like