Você está na página 1de 10

PROGRAM NO.

1
#include<stdio.h>
#include<conio.h>
int main()
{
int a, b,sum;
a=10;
b=35;
sum=a+b;
printf("hello, this is my first programming session\n");
printf("new line\n\n");
printf("the sum of %d and %d is %d",a,b,sum);
getch();

PROGRAM NO .2

#include<stdio.h>
#include<conio.h>
int main()
{
float sal,a,total;
sal=100000000000000000000000000000000000000.1239847;
a=2.015;
total=sal*a;
printf("salary of xyz company\n");
printf("salary per 15 days is%f\n",sal);
printf("salary per month is %f",total);

getch();

PROGRAM NO. 3
#include<stdio.h>
#include<conio.h>

main()
{
float time,princ,rate,simple;
simple=4016.25;
time=5;
rate=0.09;
princ=(100*simple)/(rate*time);
printf("principal is %f",princ);
getch();
}

PROGRAM NO .4

#include<stdio.h>
#include<conio.h>
#include<math.h>
main()
{
float a,r,s,ci;
float y;
printf("enter the amount deposited :");
scanf("%f",&a);
printf("rate of interest = ");
scanf("%f",&r);
printf("enter no. of years for which simple interest is to be
calculated :" );
scanf("%f",&y);
s=(a*r*y)/100;
printf("the simple intrest is %f \n ",s);
ci=a*pow((100+r)/100,y);
printf("the compound interest is %f",ci);
getch();

PROGRAM NO . 5
#include<stdio.h>
#include<conio.h>

main()
{
float h,lc,m,t;
printf("the labour rate per hour is Rs 45");
printf("hours of labour required :");
scanf("%f",&h);
lc=45*h;
printf("labour cost = %f",lc);
printf("enter cost of materials :");
scanf("%f",&m);
t=lc+m;
printf("the total cost = %f",t);
getch();

PROGRAM NO .6

#include<stdio.h>
#include<conio.h>

main()
{

float l,b,h,ta,c,t;
printf("enter length in meters :");
scanf("%f",&l);
printf("enter breath :");
scanf("%f",&b);
printf("enter height :");
scanf("%f",&h);
ta =l*b*h;
printf("total area is %f",ta );
printf("cost of paint per sq meter :");
scanf("%f",&c);
t=2*(c*ta);
printf("total cost of painting %f :",t);
getch();
}
PROGRAM NO .7

#include <stdio.h>
#include <conio.h>
main()
{
float wt,ht,bmi;
printf(" enter your weight(in pounds) :");
scanf("%f",&wt);
printf("enter your height(in inches) :");
scanf("%f",&ht);
bmi=(wt*703)/(ht*ht);
printf("your bmi is : %f",bmi);
getch();
}

PROGRAM NO . 8

#include <stdio.h>
#include <conio.h>

main()
{
int id;
float bp,da,pf,hra,sal;
printf("enter employee id no. : ");
scanf("%d",&id);
printf("enter the basic pay: ");
scanf("%f",&bp);
da=0.8*bp;
hra=0.3*bp;
pf=0.12*bp;
sal=(bp+da+hra)-pf;
printf(" salary details of the employee \n D.A.:Rs %f \n H.R.A:Rs
%f \n P.F.:Rs %f \n the total salary : Rs %f ",da,hra,pf,sal);
getch();
}

PROGRAM NO . 9

#include <stdio.h>
#include <conio.h>

main()
{
float w,b,o,f,w1,b1,o1,f1,tw,tb,to,tf;

printf("enter amount of wheat produced :");


scanf("%f",&w);
printf("enter amount of barley produced :");
scanf("%f",&b);
printf("enter amount of oats produced :");
scanf("%f",&o);
printf("enter amount of flax produced :");
scanf("%f",&f);
printf("enter price of wheat per kg :");
scanf("%f",&w1);
printf("enter price of barley per kg :");
scanf("%f",&b1);
printf("enter price of oats per kg :");
scanf("%f",&o1);
printf("enter price of flax per kg :");
scanf("%f",&f1);
tw=w*w1;
tb=b*b1;
to=o*o1;
tf=f*f1;
printf("the total production details \n wheat :Rs %f \n barley:Rs
%f \n oats:Rs %f \n flax :Rs %f ",tw,tb,to,tf);
getch();

PROGRAM NO .10

#include<stdio.h>
#include<conio.h>
main()
{
int age ;
printf("Enter your age ");
scanf("%d",&age);
if(age>=16 && age<=18)
{
printf("you are eligible ");
}
else
{
printf("sorry you are not eligible for the electoral role ");
}
getch();
}

PROGRAM NO .11

#include<stdio.h>
#include<conio.h>
main()
{
float cp, ds,tc;
int qn;
printf("enter the quantity of the item puchased :");
scanf("%d",&qn);
printf("enter the cost per item :");
scanf("%f",&cp);
tc=qn*cp;
printf("total cost:",tc);
if(tc>=5000)
{
ds=0.1*tc;
tc=tc-ds;
printf("total cost after discount ic %f",tc);

}
else
{
printf("sorry you have no discount");
}
getch();
}

PROGRAM NO.12

#include <stdio.h>
#include <conio.h>

main()
{
float wt,ht,bmi;
printf(" enter your weight :");
scanf("%f",&wt);
printf("enter your height :");
scanf("%f",&ht);
bmi=(wt)/(ht*ht);
printf("your bmi is : %f",bmi);
if(bmi<25)
{
printf("you are healthy");
}
else
{
printf("you are obese ");
}
getch();
}

PROGRAM NO .13

#include<stdio.h>
#include<conio.h>
main()
{
float ele,e1,e2,amt1,amt2,t;
printf("enter the total units of elect. used");
scanf("%f",&ele);

if(ele>50)
{
if(ele>100)
{
e1=ele-100;
amt1=e1*3.5;
amt2=(50*2)+(50*2.5);

}
else
{
e1=ele-50;
amt1=e1*2.5;
amt2=50*2;
}
}
t=amt1+amt2+20;
printf("total amount=%f",t);
getch();
}

PROGRAM NO.14

#include<stdio.h>
#include<conio.h>
main()
{
float lr,vr,aa,pl,t;
printf("enter marks in \nLR ,VR,AA,PL\n");
scanf("%f %f %f %f",&lr,&vr,&aa,&pl);
t=lr+vr+aa+pl;
if(t>=180)
{
if(lr>47.5 && vr>47.5 && aa>47.5 && pl>47.5)
{
printf("you r eligible for genius test 2");
}
else if(lr>45&&lr<47.5 &&vr>45&&vr<47.5
&&aa>45&&aa<47.5 &&pl>45&&pl<47.5)
{
printf("you r not eligible for g 2 \n you can take g1");
}
}
else
{
printf("you cant take any test ");

}
getch();
}

PROGRAM NO .15

#include<stdio.h>
#include<conio.h>

main()
{
int i,h=0,c=0,p=0;
float t;
printf("The meteorological dept.");
for(i=1;i<=30;i++)
{
printf("\n enter the temp on %dth of the month",i);
scanf("%f",&t);
if(t<60)
c=c+1;
else if(t>60 && t<84)
p=p+1;
else if(t>84)
h=h+1 ;
}
printf("there were %d pleasent days \n %d hot days \n & %d cold
days ",p,h,c);
getch();
}

PROGRAM NO .16

#include<stdio.h>
#include<conio.h>

main()
{
int i,n,s;

printf("current seats = 120");


printf("\n enter no of years after which the no. of seats r to b known
");
scanf("%d",&n);
s=120;
for(i=1;i<=n;i++)
{
s=s+60;
}
printf("total no of seats after %d is %d ",n,s);
getch();
}

Você também pode gostar