Program To Display The Student Marks Details Using Structure
Program To Display The Student Marks Details Using Structure
#include<stdio.h>
#include<conio.h>
struct stu
{
int rno;
char name[25];
int marks[6];
float avg;
char grade;
}it[10];
void main()
{
int n,i,j,sum;
float a;
clrscr();
printf("Enter no. of students\n");
scanf("%d",&n);
for(i=0;i<n;i++)
{
sum=0;
printf("Student %d record \n",i+1);
printf("Enter students rno\n");
scanf("%d",&it[i].rno);
printf("Enter students name\n");
scanf("%s",it[i].name);
printf("Enter 6 sub. marks\n");
for(j=0;j<6;j++)
{
scanf("%d",&it[i].marks[j]);
sum=sum+it[i].marks[j];
}
it[i].avg=sum/6.0;
a=it[i].avg;
if(a>=75)
it[i].grade='A';
else if((a>=60) && (a<75))
it[i].grade='B';
else if((a>=50) && (a <60))
it[i].grade='C';
else
it[i].grade='D';
}
printf("Student Records\n");
scanf("%d",&m1[i][j]);
printf("\n Enter the Elements of the matrix m2");
for(i=0;i<r1;i++)
for(j=0;j<c1;j++)
scanf("%d",&m2[i][j]);
printf("\n Resultant Matrix\n");
for(i=0;i<r1;i++)
{
for(j=0;j<c1;j++)
{
r[i][j]=m1[i][j]-m2[i][j];
printf("%d\t",r[i][j]);
}//inner for
printf("\n");
} //outer for
break;
case 3:
printf("\n Enter the order of the matrix m1\n");
scanf("%d %d",&r1,&c1);
printf("\n Enter the Elements of the matrix m2");
scanf("%d %d",&r2,&c2);
if(c1==r2)
{
printf("\n Enter the elements of the Matrix m1");
for(i=0;i<r1;i++)
for(j=0;j<c1;j++)
scanf("%d",&m1[i][j]);
printf("\n Enter the Elements of the matrix B");
for(i=0;i<r2;i++)
for(j=0;j<c2;j++)
scanf("%d",&m2[i][j]);
printf("\n Resultant Matrix\n");
for(i=0;i<r1;i++)
{
for(j=0;j<c2;j++)
{
r[i][j]=0;
for(k=0;k<r2;k++)
{
r[i][j]=r[i][j]+m1[i][k]*m2[k][j];
}
printf("%d\t",r[i][j]);
}
printf("\n");
} //for
}//if
else
printf("\n Multiplication is not possible");
break;
case 4:
printf("\n Enter the order of the matrix\n");
scanf("%d %d",&r1,&c1);
printf("\n Enter the Elements of the matrix ");
for(i=0;i<r1;i++)
for(j=0;j<c1;j++)
scanf("%d",&m1[i][j]);
printf("\n Transpose of the matrix is\n\n");
for(i=0;i<c1;i++)
{
for(j=0;j<r1;j++)
{
printf("%d\t",m1[j][i]);
}
printf("\n");
}
break;
default:
printf("Invalid choice\n");
}//switch
getch();
}
4
5
} // switch
}//if
else
printf("\n\t The equation is linear");
getch();
} //main()
Fibonacci series is
1
1
2
3
#include<conio.h>
main()
{
int a,b,c;
clrscr();
printf("Enter three numbers=\n");
scanf("%d %d %d",&a,&b,&c);
if((a>b)&&(a>c))
{
printf("%d is the biggest number\n",a);
}
else if(b>c)
{
printf("%d is the biggest number\n",b);
}
else
{
printf("%d is the biggest number\n",c);
}
getch();
}
#include<conio.h>
void main()
{ float f,c;
clrscr();
printf("\nEnter the temperature in celcius");
scanf("%f",&c);
f=c*1.8+32;
printf("\nThe fahrenheit value is %f",f);
getch();
}