Archive for the ‘Lab 9’ Category

#include<stdio.h>
int main()
{
int bs,da,hra,gs,bonus;
printf("Enetr Base Salary");
scanf("%d",&bs);
da=(40*bs)/100;
hra=(80*da)/100;
bonus=(25*hra)/200;
gs=da+hra+bonus+bs;
printf("%d",gs);
return 0;
}


Advertisements
#include<stdio.h>
int main()
{
int d;
printf("Enter days\n");
scanf("%d",&d);
printf("%d years,%d months,%d days\n",d/365,(d%365)/30,(d%365)%30);
	return 0;
}


#include<stdio.h>
#include<math.h>
int main()
{
 float p,rate,time,ci;
 printf("Enter principal amount : ");
 scanf("%f", &p);
 printf("Enter interest rate : ");
 scanf("%f", &rate);
 printf("Enter time period in year : ");
 scanf("%f", &time);
 ci=p*(pow((1+rate/100),time)-1);
 printf("\nCompound interest = %f",ci);
 return 0;
}
#include<stdio.h>
int main( )
{
	float p,rate,n,si;
	printf("Enter principal amount : ");
 scanf("%f", &p);
 printf("Enter interest rate : ");
 scanf("%f", &rate);
 printf("Enter time period in year : ");
 scanf("%f", &n);
	si = p * n * rate / 100 ;
	printf("\nSimple interest = %f",si);
	return 0;
}


#include<stdio.h>
int main()
{
	float cp,sp,pro=0,loss=0,lossper,proper;
	printf("Enter sp and cp");
	scanf("%f%f",&sp,&cp);
	if(cp>sp)
	{
		loss=cp-sp;
				}
	else if(sp>cp)
	{
		pro=sp-cp;
	}
	lossper=(loss/cp)*100;
	proper=(pro/cp)*100;
	if(cp>sp)
	{
		printf("Loss Percentage is %f",lossper);
	}
	else if(sp>cp)
	{
		printf("Profit Percentage is %f",proper);
	}
	return 0;

}
#include<stdio.h>
int main()
{
int n,sum=0;
printf("Enter Number");
scanf("%d",&n);
sum=(n*n*(n+1)*(n+1))/4;
printf("%d",sum);
return 0;
}

#include<stdio.h>
int main()
{
int n,sum=0;
printf("Enter Number");
scanf("%d",&n);
sum=n*(n+1)*(2*n+1)/6 ;
printf("%d",sum);
return 0;
}

#include<stdio.h>
int main()
{
int n,sum=0;
printf("Enter Number");
scanf("%d",&n);
sum=n*(n+1)/2;
printf("%d",sum);
return 0;
}