Archive for the ‘Lab 10B’ Category

#include<stdio.h>
int main()
{
	int n;
	scanf("%d",&n);
	if(n<=10)
	{
		printf("%d",n*n);
	}
	else if(n>10&&n<=20)
	{
		printf("%d",n*n*n);
	}
	else if(n>20)
	{
		printf("Invalid Number");
	}
	return 0;
}
#include<stdio.h>
int main()
{
	int n;
	scanf("%d",&n);
	if(n>1000)
	{
		printf("%d",2*n);
	}
	else
		printf("0");
	return 0;
}

#include<stdio.h>
void main()
{
float a,b,c,sum;
printf("enter three angles a,b,c");
scanf("%f%f%f",&a,&b,&c);
sum=a+b+c;
if(sum==180)
printf("triangle is valid");
else
printf("triangle is not valid");
}

#include<stdio.h>
void main()
{
	int cp,sp,pro,loss;
	printf("Enter sp and cp");
	scanf("%d%d",&cp,&sp);
	if(cp>sp)
	{
		loss=cp-sp;
		printf("loss is %d",loss);
		}
	else
	{
		pro=sp-cp;
	printf("pro is %d",pro);
	}
}

#include<stdio.h>
#include<math.h>
void main()
{
int ajay,ram,shyam;
printf("enter the ages of ajay,ram,shyam");
scanf("%d%d%d",&ajay,&ram,&shyam);
if((ajay>ram)&&(shyam>ajay))
{
printf("\n the youngest of the three is ram");
}
if((ram>ajay)&&(shyam>ajay))
{
printf("\n the youngest of the three is ajay");
}
if((ram>shyam)&&(ajay>shyam))
{
printf("\n the youngest of the three is shyam");
}
}
#include<stdio.h>
#include<math.h>
void main()
{
	int num,num1,rev=0,p=4,temp;
	printf("Enter num");
	scanf("%d",&num);
	temp=num;
while(num>0)
	{
num1=num%10;
		rev=rev+num1*pow(10,p--);
	num=num/10;
	}
	printf("%d",rev);
	if(rev==temp)
		{
		printf("Reversed no.is equal");
}
	else
	{
		printf("Reversed no. is not equal");
		}
		}
#include<stdio.h>
void main()
{
	float bs,da,hr,gs;
	printf("Enter bs");
	scanf("%f",&bs);
	da=(40*bs)/100;
	hr=(20*bs)/100;
	gs=bs+da+hr;
	printf("%f\n%f\n%f\n",da,hr,gs);
}

#include<stdio.h>
int main()
{
int i=8,j=5;
	i=(i%j);
	printf("%d",i);
	return 0;
}