Search This Blog

Monday 29 August 2011

C-PRAOGRAMM to find the mileage of a vehicle


#include<stdio.h>
#include<conio.h>
main()
{
float p,m,kms;
clrscr();
printf("enter the quantity of fuel you filled :");
scanf("%f",&p);
printf("enter the kilometers covered by %.2f liters of fuel :",p);
scanf("%f",&kms);
m=kms/p;
printf("the mialge of your vehicle is %.2f kilometers/liter",m);
getch();
}

C-PRAOGRAMM to find the table of any number


#include<stdio.h>
#include<conio.h>
main()
{
int i=1,t;
clrscr();
printf("the multiplication table of ?");
scanf("%d",&t);
while(i<=10)
{
printf("\n %d*%d=%d",t,i,(t*i));
i++;
}
getch();
}

C-PRAOGRAMM to find the arithmetic progression


include<stdio.h>
#include<conio.h>
main()
{
int t1,t2,tn,a,d,n;
clrscr();
printf("enter the value for t1\n");
scanf("%d",&t1);
if(t1<1)
{
printf("enter the value a\n");
scanf("%d",&a);
printf("enter the value for d\n");
scanf("%d",&d);
}
else
{
printf("enter the value for t2\n");
scanf("%d",&t2);
}
printf("enter the value for n\n");
scanf("%d",&n);
if((t1!=0)&&(t2!=0))
{
d=t2-t1;
tn=t1+(n-1)*d;
}
else
{
tn=a+(n-1)*d;
}
printf("\nt%d=%d",n,tn);
getch();
}

C-PRAOGRAMM for currency converter


#include<stdio.h>
#include<conio.h>
main()
{
float exrate,saudi,ind,t1,t2;
clrscr();
printf("\nIF YOU WANT TO CONVERT INDIAN CURRENCY INTO foreign  CURRENCY THEN ENTER foreign CURRENCY AS\'0\'");
printf("\n\n\n\nenter the exchange rate of currency in india:");
scanf("%f",&exrate);
printf("enter the foreign currency:");
scanf("%f",&saudi);
t1=exrate*saudi;
if(saudi==0)
{
printf("enter the indian currency:");
scanf("%f",&ind);
t2=ind/exrate;
}
if(saudi>0)
{
printf("\ntotal indian currency=%.2f",t1);
}
else
{
printf("\ntotal saudi currency=%.2f",t2);
}
getch();
}

Sunday 28 August 2011

'C' PROGRAM TO FIND THE ISBN CODE


#include<stdio.h>
void main()
{
int isbn[10],i,sum=0,rem;
printf("enter the isbn code :");
for(i=0;i<10;i++)
scanf("%d",&isbn[i]);
for(i=0;i<9;i++)
sum=sum+((i+1)*isbn[i]);
rem=sum%11;
if(rem==isbn[9])
printf("it is an valid isbn code ");
else
printf("it is not an valid isbn code");
}

Saturday 27 August 2011

C-PRAOGRAMM FOR INPUT THE TEMPERATUREOF DIFFRNT DAY AND CITIES AND FIND THE HIGHEST AND THE LOWEST TEMP.


#include<stdio.h>
void main()
{
float a[20][20],max,min;
int days,city,i,j,max_day,max_city,min_day,min_city;
printf("enter how days :");
scanf("%d",&days);
printf("enter how many cities :");
scanf("%d",&city);
for(i=0;i<days;i++)
for(j=0;j<city;j++)
{
printf("enter the temperature on day %d in city %d\n",(i+1),(j+1));
scanf("\n%f",&a[i][j]);
}
printf("\t\tTEMPERATURE\n");
for(i=1;i<=city;i++)
printf("\tcity %d",i);
printf("\nday 1:");
for(i=0;i<days;i++)
{
for(j=0;j<city;j++)
{
printf("\t%.2f",a[i][j]);
}
printf("\n");
if(i==(days-1))
break;
printf("day %d:",(i+2));
}
max=a[0][0];
max_day=1;
max_city=1;
min=a[0][0];
min_day=1;
min_city=1;
for(i=0;i<days;i++)
{
for(j=0;j<city;j++)
{
if(a[i][j]>max)
{
max=a[i][j];
max_day=i+1;
max_city=j+1;
}
if(a[i][j]<min)
{
min=a[i][j];
min_day=i+1;
min_city=j+1;
}
}
}
printf("\nthe highest temperature is %.2f on day %d in city %d",max,max_day,max_city);
printf("\nthe lowest temperature is %.2f on day %d in city %d",min,min_day,min_city);
}





c-program to input the marks of (n)students and(n) subjects and to find total marks obtain by each student ,the highest marks in each subject and the roll number of the student who secured it,the student who obtained the highest total marks

#include<stdio.h>
void main()
{
int marks[20][20],roll_num,sub,i,j,tot[20],totmax,trno,sum=0,max,max_rno;
printf(" enter number of student :");
scanf("%d",&roll_num);
printf("enter the number of subjects :");
scanf("%d",&sub);
for(i=0;i<roll_num;i++)
for(j=0;j<sub;j++)
{
printf("enter the marks of subject %d of roll number:%d\n",(j+1),(i+1));
scanf("%d",&marks[i][j]);
}
printf("\n\t\tMARK LIST\n");
for(i=1;i<=sub;i++)
printf("\tsub %d",i);
printf("\nrno:1");
for(i=0;i<roll_num;i++)
{
for(j=0;j<sub;j++)
{
printf("\t%d",marks[i][j]);
}
printf("\n");
if(i==(roll_num-1))
break;
printf("rno:%d",(i+2));

}
for(i=0;i<roll_num;i++)
{
for(j=0;j<sub;j++)
{
sum=sum+marks[i][j];
}
tot[i]=sum;
sum=0;
}

for(j=0;j<sub;j++)
{
    i=0;
max=marks[0][j];
max_rno=1;
for(i=0;i<roll_num;i++)
{
if(marks[i][j]>max)
{
max=marks[i][j];
max_rno=i+1;
}

if(i==(roll_num-1))
{
printf("\nthe highest marks in subject %d is %d and its is scored by roll number %d",(j+1),max,max_rno);
}
}

}
printf("\n\n\tTOTAL MARKS\n");
for(i=0;i<roll_num;i++)
{
printf("rno:%d\t%d\n",(i+1),tot[i]);
}
totmax=tot[0];
trno=1;
for(i=1;i<roll_num;i++)
{
if(tot[i]>totmax)
{
totmax=tot[i];
trno=i+1;
}
}
printf("the student who obtained the highest total mark is\n");
printf("rno:%d\nmarks:%d",trno,totmax);


}