We are building EduLadder(ELADR) - Protocol

The Eladr Protocol is a decentralized, security and efficiency enhanced Web3 noSQL database powered by IPFS as the data storage layer https://ipfs.io/, and the Cardano block chain as the rewards token platform, https://cardano.org/. It provides a JSON based, IPFS layer 2 solution for data indexing and retrieval in an 'append only' file system built with open source Node.js API libraries.

The ELADR token was designed to incentivize and reward community members as a proof of contribution. Token holders are also granted access to EduLadder.com premium features as well as associated ELADR token enabled apps.

WHITE PAPER Buy Now Try BETA

Real Problems! Real Experts!

Join Our Telegram Channel !


The Eduladder is a community of students, teachers, and programmers. We help you to solve your academic and programming questions fast.
In eduladder you can Ask,Answer,Listen,Earn and Download Questions and Question papers.
Watch related videos of your favorite subject.
Connect with students from different parts of the world.
Apply or Post Jobs, Courses ,Internships and Volunteering opportunity. For FREE
See Our team
Wondering how we keep quality?
Got unsolved questions? Ask Questions


You are here:Open notes-->Anna-University-->GE2115-Computer-practice-Laboratory-Part-7

GE2115-Computer practice Laboratory Part-7


How to study this subject


61. Program a structure which reads ‘n’ students information (name,3 subjects marks) and calculate
total marks, result print them in a particular format.
# include
# include
main( )
{
struct student
{
char name[20];
int m1,m2,m3, tot;
char result[10];
}stud[10];
int i,n;
clrscr( );
printf(“enter no of students \n”);
scanf(“%d”,&n);
for(i=0;i
{
printf(”enter %d student deatails \n”,i);
printf(”enter name\n”);
scanf(“%s”, stud[i].name);
printf(“enter marks of 3 subjects \n”);
scanf(“%d%d%d”, &stud[i].m1,&stud[i].m2,&stud[i].m3);
stud[i].tot=stud[i].m1+stud[i].m2+stud[i].m3;
if((stud[i].m1>35)&&(stud[i].m2>35)&&(stud[i].m3>35))
strcpy(stud[i].result,”pass”);
else
strtcpy(stud[i].result,”fail”);
}
clrscr( );
printf(“name total result \n”);
for(i=0;i
{
printf(“%s %d %s \n”, stud[i].name,stud[i].tot,stud[i].result);
}
getch( );
}
62. Program to find whether a square matrix is a) symmetric b) skew symmetric c) none of two.
# include
# include
main( )
{
int a[10][10],i,j,m,n,c=0,c1=0; 28
clrscr( );
printf(“enter the array size”);
scanf(“%d”,&n);
printf(“enter the elements”);
for(i=1;i<=m;i++)
for(j=1;j<=n;j++)
scanf(“%d”,&a[i][j]);
for(i=1;i<=m;i++)
for(j=1;j<=n;j++) {
if(a[i][j]==a[j][i])
c=1;
else
if(a[i][j]==a[j][i])
c1=1; }
printf(“the given matrix is \n”);
for(i=1;i<=m;i++) {
for(j=1;j<=n;j++)
printf(“%4d”,a[i][j]);
printf(“\n”); }
if(c==0)
printf(“the given matrix is symmetric”);
else
if(c1==0)
printf(“the matrix is skew symmetric”);
else
printf(“none of two”); }
getch( ); }
63. Program to find area of a triangle when there sides are given.
# include
# include
main( )
 {
int a,b,c;
float s, area;
clrscr( );
printf(“enter there sides of the triangle”);
scanf(“%d%d%d”,&a,&b,&c);
if((a+b)
printf(“finding area is not possible”);
else
s=(a+b+c)/2;
area=sqrt(s*(s-a)*(s-b)*(s-c));
printf(“area=%.2f”,area);
getch( ); } 29
64. Program to print Armstrong number between 1-500.
#include
#include
main( ) {
int i,n,s,r;
clrscr( );
for(i=1;i<=500;i++) {
n=i;
s=0;
while(n>0) {
r=n%10;
s=s+(r*r*r);
n=n/10; }
if(i==s)
printf(“\n%d”,s); }
getch(); }
65. Program to check whether a given number is Armstrong or not.
# include
# include
main( ) {
int i,n,s,r,k;
clrscr( );
printf(“enter a number”);
scanf(“%d”,&n);
k=n;
s=0;
while(n>0) {
r=n%10;
s=s+(r*r*r);
n=n/10; }
if(k==s)
printf(“given number is Armstrong %d”,k);
else
printf(“given number is not Armstrong %d”,k); }
getch(); }
66. Program to print the floyd’s triangle.
# include
# include
main( ) 30
{
int i,n,s,r k=1;
clrscr( );
printf(“enter a number of rows”);
scanf(“%d”,&n);
for(i=1;i<=n;i++) {
for(s=1;s<=40-i;s++)
printf(“ ”);
for(j=1;j<=i;j++)
printf(“%3d”,k++);
printf(“\n”); }
getch( ); }
67. Program to read data in 3 structures and print
# include
# include
main( ) {
struct book {
char code;
int piece;
float price;
};
struct book b1,b2,b3;
main( ) {
clrscr( );
printf(“enter code,piece,price”);
scanf(“%c%d%f”,&b1.code,&b1.piece,&b1.price);
printf(“enter code,piece,price”);
scanf(“%c%d%f”,&b2.code,&b2.piece,&b2.price);
printf(“enter code,piece,price”);
scanf(“%c%d%f”,&b3.code,&b3.piece,&b3.price);
printf(“the details are”);
printf(“\n %c%d%f”,b1.code,b1.piece,b1.price);
printf(“\n %c%d%f”,b2.code,b2.piece,b2.price);
printf(“\n %c%d%f”,b3.code,b3.piece,b3.price);
getch( ); }
68
. Program to print a diagonal matrix.
 #include
#include
main() {
int a[4][4],i,j;
clrscr( ); 31
for(i=0;i<4;i++)
for(j=0;j<4;j++)
if(i==j)
c[i][j]=7;
else
a[i][j]=0;
for(i=0;i<4;i++)
{
for(j=0;j<4;j++)
printf(“%d”,a[i][j]);
printf(“\n”);
}
getch();
}
69. Program to copy contents of one file into another.
#include
 #include
main( )
{
FILE *fp1,*fp2;
char ch;
fp1=fopen(“text1”,”w”);
printf(‘enter the text”);
while((ch=getchar( ))!=EOF)
putc(ch,fp1);
fclose(fp1);
fp1=fopen(“text1”,”r”);
fp2=fopen(“text2”,”w”);
while((ch=getc(fp1))!=EOF)
putc(ch,fp2);
fclose(fp2);
getch( );
}
70. Program to create a file of number and copy odd number into second file and even number into
third file.
#include
 #include
main( )
{
FILE *fp1,*fp2,*fp3;
int i;
fp1=fopen(“DATA1”,”w”);
printf(“enter the number”);
scanf(“%d”,&i);
while(i!=eof( ))
{
putw(i,fp1);
}
fcolse(fp1);
fp1=fopen(“DATA1”,”r”);
fp2=fopen(“DATA2”,”w”); 32
fp3=fopen(“DATA3”,”w”);
while((i=getw(fp1))!=EOF())
if(i%2= =0)
putw(i,fp3);
else
putw(i,fp2);
fcolse(fp1);
fcolse(fp2);
fcolse(fp3);
getch( );
}

61. Program a structure which reads ‘n’ students information (name,3 subjects marks) and calculate
total marks, result print them in a particular format.
# include
# include
main( )
{
struct student
{
char name[20];
int m1,m2,m3, tot;
char result[10];
}stud[10];
int i,n;
clrscr( );
printf(“enter no of students \n”);
scanf(“%d”,&n);
for(i=0;i
{
printf(”enter %d student deatails \n”,i);
printf(”enter name\n”);
scanf(“%s”, stud[i].name);
printf(“enter marks of 3 subjects \n”);
scanf(“%d%d%d”, &stud[i].m1,&stud[i].m2,&stud[i].m3);
stud[i].tot=stud[i].m1+stud[i].m2+stud[i].m3;
if((stud[i].m1>35)&&(stud[i].m2>35)&&(stud[i].m3>35))
strcpy(stud[i].result,”pass”);
else
strtcpy(stud[i].result,”fail”);
}
clrscr( );
printf(“name total result \n”);
for(i=0;i
{
printf(“%s %d %s \n”, stud[i].name,stud[i].tot,stud[i].result);
}
getch( );
}
62. Program to find whether a square matrix is a) symmetric b) skew symmetric c) none of two.
# include
# include
main( )
{
int a[10][10],i,j,m,n,c=0,c1=0; 28
clrscr( );
printf(“enter the array size”);
scanf(“%d”,&n);
printf(“enter the elements”);
for(i=1;i<=m;i++)
for(j=1;j<=n;j++)
scanf(“%d”,&a[i][j]);
for(i=1;i<=m;i++)
for(j=1;j<=n;j++) {
if(a[i][j]==a[j][i])
c=1;
else
if(a[i][j]==a[j][i])
c1=1; }
printf(“the given matrix is \n”);
for(i=1;i<=m;i++) {
for(j=1;j<=n;j++)
printf(“%4d”,a[i][j]);
printf(“\n”); }
if(c==0)
printf(“the given matrix is symmetric”);
else
if(c1==0)
printf(“the matrix is skew symmetric”);
else
printf(“none of two”); }
getch( ); }
63. Program to find area of a triangle when there sides are given.
# include
# include
main( )
 {
int a,b,c;
float s, area;
clrscr( );
printf(“enter there sides of the triangle”);
scanf(“%d%d%d”,&a,&b,&c);
if((a+b)
printf(“finding area is not possible”);
else
s=(a+b+c)/2;
area=sqrt(s*(s-a)*(s-b)*(s-c));
printf(“area=%.2f”,area);
getch( ); } 29
64. Program to print Armstrong number between 1-500.
#include
#include
main( ) {
int i,n,s,r;
clrscr( );
for(i=1;i<=500;i++) {
n=i;
s=0;
while(n>0) {
r=n%10;
s=s+(r*r*r);
n=n/10; }
if(i==s)
printf(“\n%d”,s); }
getch(); }
65. Program to check whether a given number is Armstrong or not.
# include
# include
main( ) {
int i,n,s,r,k;
clrscr( );
printf(“enter a number”);
scanf(“%d”,&n);
k=n;
s=0;
while(n>0) {
r=n%10;
s=s+(r*r*r);
n=n/10; }
if(k==s)
printf(“given number is Armstrong %d”,k);
else
printf(“given number is not Armstrong %d”,k); }
getch(); }
66. Program to print the floyd’s triangle.
# include
# include
main( ) 30
{
int i,n,s,r k=1;
clrscr( );
printf(“enter a number of rows”);
scanf(“%d”,&n);
for(i=1;i<=n;i++) {
for(s=1;s<=40-i;s++)
printf(“ ”);
for(j=1;j<=i;j++)
printf(“%3d”,k++);
printf(“\n”); }
getch( ); }
67. Program to read data in 3 structures and print
# include
# include
main( ) {
struct book {
char code;
int piece;
float price;
};
struct book b1,b2,b3;
main( ) {
clrscr( );
printf(“enter code,piece,price”);
scanf(“%c%d%f”,&b1.code,&b1.piece,&b1.price);
printf(“enter code,piece,price”);
scanf(“%c%d%f”,&b2.code,&b2.piece,&b2.price);
printf(“enter code,piece,price”);
scanf(“%c%d%f”,&b3.code,&b3.piece,&b3.price);
printf(“the details are”);
printf(“\n %c%d%f”,b1.code,b1.piece,b1.price);
printf(“\n %c%d%f”,b2.code,b2.piece,b2.price);
printf(“\n %c%d%f”,b3.code,b3.piece,b3.price);
getch( ); }
68
. Program to print a diagonal matrix.
 #include
#include
main() {
int a[4][4],i,j;
clrscr( ); 31
for(i=0;i<4;i++)
for(j=0;j<4;j++)
if(i==j)
c[i][j]=7;
else
a[i][j]=0;
for(i=0;i<4;i++)
{
for(j=0;j<4;j++)
printf(“%d”,a[i][j]);
printf(“\n”);
}
getch();
}
69. Program to copy contents of one file into another.
#include
 #include
main( )
{
FILE *fp1,*fp2;
char ch;
fp1=fopen(“text1”,”w”);
printf(‘enter the text”);
while((ch=getchar( ))!=EOF)
putc(ch,fp1);
fclose(fp1);
fp1=fopen(“text1”,”r”);
fp2=fopen(“text2”,”w”);
while((ch=getc(fp1))!=EOF)
putc(ch,fp2);
fclose(fp2);
getch( );
}
70. Program to create a file of number and copy odd number into second file and even number into
third file.
#include
 #include
main( )
{
FILE *fp1,*fp2,*fp3;
int i;
fp1=fopen(“DATA1”,”w”);
printf(“enter the number”);
scanf(“%d”,&i);
while(i!=eof( ))
{
putw(i,fp1);
}
fcolse(fp1);
fp1=fopen(“DATA1”,”r”);
fp2=fopen(“DATA2”,”w”); 32
fp3=fopen(“DATA3”,”w”);
while((i=getw(fp1))!=EOF())
if(i%2= =0)
putw(i,fp3);
else
putw(i,fp2);
fcolse(fp1);
fcolse(fp2);
fcolse(fp3);
getch( );
}

Add contents here


Official Notes


Add contents here


Notes from other sources


Add contents here


Model question papers


Add contents here


Previous year question papers


Add contents here


Useful links


Add contents here




Editors




You might like this video:Watch more here

Watch more videos from this user Here

Learn how to upload a video over here