0% found this document useful (0 votes)
297 views

1st PUC Computer Lab Manual-2023

The document provides a practical blueprint for a C++ programming exam containing 24 questions across 3 sections - C++, Excel, and HTML. The C++ section includes questions on basic programming concepts like variable interchange, area calculations, loops, arrays, sorting, functions etc. It provides the question, algorithm/flowchart, sample code and output for each question. The duration of the exam is 2 hours carrying a total of 30 marks, with 12 marks for the written questions, 6 marks for executing a program, 2 marks for output, 4 marks for viva, and 6 marks for the practical record.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
297 views

1st PUC Computer Lab Manual-2023

The document provides a practical blueprint for a C++ programming exam containing 24 questions across 3 sections - C++, Excel, and HTML. The C++ section includes questions on basic programming concepts like variable interchange, area calculations, loops, arrays, sorting, functions etc. It provides the question, algorithm/flowchart, sample code and output for each question. The duration of the exam is 2 hours carrying a total of 30 marks, with 12 marks for the written questions, 6 marks for executing a program, 2 marks for output, 4 marks for viva, and 6 marks for the practical record.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 69

Contents

PRACTICAL BLUEPRINT 2
SECTION A - C++
1a.Write a program to interchange the values of two variables using a third variable. 3
1b.Write a program to interchange the values of two variables without using a third variable. 5
2.Write a program to find the area and circumference of a circle. 7
3.Write a program to find the area of a triangle given three sides. 9
4.Write a program to convert days into years, months and days. 11
5. Write a program to find the largest, smallest and second. 13
6. Write a program to input the total amount in a bill using if-statement. 15
7.Write a program to check whether a given year is a leap year or not, using an if-else statement. 17
8. Write a program to input the number of units and calculate the final amount using a nested-if statement. 19
9. Write a program to input the four subject marks, calculate the total percentage using a switch statement. 22
10.Write a program to find the sum of all the digits of a number using a while statement. 25
11.Write a program to check whether a given number is a power of 2. 27
12.Write a program to check whether a given number is an Armstrong number using a do-while statement. 29
13.Write a program to find the factorial of a number using a for statement. 31
14.Write a program to generate the Fibonacci sequence up to a limit using a for statement. 33
15.Write a program to find the sum and average of n number of the array. 35
16.Write a program to arrange a list of numbers in ascending order using bubble sort. 37
17.Write a program to find the position of a given number in the array. 39
18.Write a program to find the sum of each row and column separately in a given matrix . 42
19. Write a C++ program to find the sum of two compatible matrices. 45
20. Write a C++ program to determine whether the string is a palindrome. 48
21. Write a C++ program to count the number of vowels and consonants in a string. 50
22. Write a C++ program to find the GCD and LCM of two numbers using functions. 53
23. Write a C++ program to find Xy using functions.
24. Write a program to input the register number, name and class of all the students in a class into a
structure and output the data in a tabular manner with proper heading.

SECTION B - EXCEL
25. .Generate Sales report 50
26. .Compute salary and tax 55
27..Compute percentage of marks 63
28.Compute savings and expenditure 71
SECTION C - HTML
29.Write a HTML program to create a webpage about yourself. 81
30..Write a HTML program to create a webpage about your college 83

1
PRACTICAL BLUE PRINT
Duration of practical examination
2 Hours

Maximum marks allotted 30 Marks

There will 2 questions for writing


(One from C++ programming and one from either EXCEL or HTML) (6+6)
Each question carries 6 marks. 12 marks

Execution of any one program


(Examiner’s choice) 6 marks

Generating correct output 2 marks

Viva-voce 4 marks

Practical record 6 marks

Total 30 marks

2
SECTION A - C++
1a. Write a program to interchange the values of two variables using a third variable.

#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
void main()
{
clrscr();
int a, b, temp;
cout<<“Enter two numbers: “;
cin>>a>>b;
cout<<“Before interchanging: a = “<<a<<“\t b= “<<b<<endl;
temp = a;
a = b;
b = temp;
cout<<“After interchanging: a = “<<a<<“\t b= “<<b<<endl;
getch();
}

3
Sample run:

OUTPUT 1:

4
1b. Write a program to interchange the values of two variables without using a third
variable.

#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
void main()
{
clrscr();
int a, b, temp;
cout<<“Enter two numbers: “;
cin>>a>>b;
cout<<“Before interchanging: a = “<<a<<“\t b= “<<b<<endl;
a = a + b;
b = a – b;
a = a - b;
cout<<“After interchanging: a = “<<a<<“\t b= “<<b<<endl;
getch();
}

5
Sample run:

OUTPUT 1:

6
2. Write a program to find the area and circumference of a circle.

ALGORITHM FLOWCHART

#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
void main()
{
clrscr();
float radius, area, circum;
cout<<"Enter the radius: ";
cin>>radius;
area = 3.142 * radius * radius;
circum = 2 * 3.142 * radius;
cout<<"Area = "<<area<<endl;
cout<<"Circumference = "<<circum<<endl;
getch();
}

7
Sample run:

OUTPUT 1:

8
3. Write a program to find the area of a triangle given three sides.

#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
double s1, s2, s3, s, area;
cout<<"Enter the length of 3 sides: ";
cin>>s1>>s2>>s3;

9
s = (s1+s2+s3)/2;
area = sqrt(s*(s-s1)*(s-s2)*(s-s3));
cout<<"Area = "<<area<<endl;
getch();
}

Sample run:

OUTPUT 1:

10
4. Write a program to convert days into years, months and days.
(Hint: Assume all months have 30 days)

#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
void main()
{
clrscr();
int totaldays, days, months, years;
cout<<"Enter the total days: ";
cin>>totaldays;
years = totaldays/365;
totaldays = totaldays%365;
months = totaldays/30;
days = totaldays%30;
cout<<"Days = "<<days<<endl;

11
cout<<"Months = "<<months<<endl;
cout<<"Years = "<<years<<endl;
getch();
}

Sample run:

OUTPUT 1:

12
5. Write a program to find the largest, smallest and second.

ALGORITHM FLOWCHART

#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
void main()
{
clrscr();
int a, b, c, largest, seclargest, smallest;
cout<<"Enter three numbers: ";

13
cin>>a>>b>>c;
largest = a;
if (b>largest)
largest = b;
if (c>largest)
largest = c;
smallest = a;
if (b<smallest)
smallest = b;
if (c<smallest)
smallest = c;
seclargest = (a+b+c)-( largest+ smallest);
cout<<"Smallest = "<<smallest<<endl;
cout<<"Second largest = "<<seclargest<<endl;
cout<<"Largest = "<<largest<<endl;
getch();
}

Sample run:

OUTPUT 1:

14
6. Write a program to input the total amount in a bill, if the amount is greater than 1000,
a discount of 8% is given. Otherwise, no discount is given. Output the total amount,
discount and the final amount. Use if- statement.

#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
void main()
{
clrscr();
float amount, discount, netdiscount, netamount;
cout<<"Enter the total purchase: ";
cin>>amount;
discount = 0.0;
if (amount>=1000)
discount = (float)8/100; //Type casting

15
netdiscount = amount * discount;
netamount = amount - netdiscount;
cout<<"Nett discount = "<<netdiscount<<endl;
cout<<"Nett amount = "<<netamount<<endl;
getch();
}

Sample run:

OUTPUT 1:

OUTPUT 2:

16
7. Write a program to check whether a given year is a leap year or not, using if-else
statement.

ALGORITHM

FLOWCHART

#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
void main()
{
clrscr();
int year;
cout<< "Enter the year:" ;
cin>> year;
if ( year%4 == 0 && year%100 != 0 || year%400 == 0 )
cout<<"It is a leap year"<<endl;
else

17
cout<<"It is not leap year"<<endl;
getch();
}
Sample run:

OUTPUT 1:

OUTPUT 2:

18
8. Write a program to input the number of units of electricity consumed in a house and
calculate the final amount using nested-if statement. Use the following data fo
calculation
Units Consumed Cost
< 30 Rs 3.50 / unit
>=30 and <50 Rs 4.25 / unit
>=50 and < 100 Rs 5.25 / unit
>=100 Rs 5.85 /unit

ALGORITHM

19
FLOWCHART

#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
void main()
{
clrscr();
int oldread, newread, units;
float minamt, vat, amt, netamt;
cout<<"Enter the old reading: ";
cin>>oldread;
cout<<"Enter the new reading: ";
cin>>newread;
cout<<"Enter the minimum: ";
cin>>minamt;
units= newread - oldread;
if (units < 30)
amt = units * 3.50;

20
else if (units < 50)
amt = (29 * 3.50) + (units - 29) * 4.25;
else if (units < 100)
amt = (29 * 3.50) + (20 * 4.25) + (units - 49) * 5.25;
else
amt = (29 * 3.50) + (20 * 4.25) + (50 * 5.25) + (units - 99) * 5.85;
vat = 12.5/100;
netamt = (amt * vat) + minamt;
cout<<"Final amount = "<<netamt;
getch();
}

Sample run:

OUTPUT 1:

21
9. Write a program to input the marks of four subjects. Calculate the total percentage
and output the result as either “First class” or “Second class” or “Pass class” or “Fails”
using switch statement.

Class Range(%)
First Class Between 60 and 100%
Second Class Between 50 and 59%
Pass Class Between 40 and 49%
Fails Less than 40%

ALGORITHM

22
FLOWCHART

#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
void main()
{
clrscr();
int m1, m2, m3, m4, total, choice;
float percentage;
cout<<"Enter the marks of four subjects:";
cin>>m1>>m2>>m3>>m4;
total = m1 + m2 + m3 + m4;
percentage = total/4.0;
choice = (int)percentage/10; //type casting
cout<<"Total marks = "<<total<<endl;
cout<<setprecision(2);
cout<<"Percentage = "<<percentage<<endl;
cout<<"The result of the student is ";

23
switch(choice)
{
case 10:
case 9:
case 8:
case 7:
case 6: cout<<"First class"<<endl;
break;
case 5: cout<<"Second class"<<endl;
break;
case 4: cout<<"Pass class"<<endl;
break;
case 3:
case 2:
case 1: cout<<"Fail"<<endl;
}
getch();
}

Sample run:

OUTPUT 1:

24
10. Write a program to find the sum of all the digits of a number using while statement.

#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
void main()
{
clrscr();
int n, m, sum, rem;
cout<<"Enter the number: ";
cin>>n;
m = n;
sum = 0;
while (n != 0)
{
rem = n%10;
sum = sum + rem;
n = n/10;
}

25
cout<<"Sum of digits in "<<m<<" is "<<sum<<endl;
getch();
}
Sample run:

OUTPUT 1:

26
11. Write a program to check whether a given number is power of 2.

ALGORITHM FLOWCHART

#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
void main()
{
clrscr();
int n, m, status;
cout<<"Enter a number: ";
cin>>n;
m = n;
while (n>2)
{
if (n%2 == 1)
{
status = 0;

27
break;
}
else
n = n/2;
}
if(status)
cout<<m<<" is power of 2"<<endl;
else
cout<<m<<" is not power of 2"<<endl;
getch();
}
Sample run:

OUTPUT 1:

OUTPUT 2:

28
12. Write a program to check whether a given number is an Armstrong number using
do-while statement (Hint: 153 = 13 + 53+ 33).

ALGORITHM FLOWCHART

#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
void main()
{
clrscr();
int n, temp, rem,
sum;
cout<<"Enter a number: ";
cin>>n;
temp = n;
sum = 0;
do
{
rem = temp%10;
sum = sum + rem*rem*rem;

29
temp = temp/10;
} while (temp != 0);
if (sum == n)
cout<< n<<" is an Armstrong number"<<endl;
else
cout<< n<<" is not an Armstrong number"<<endl;
getch();
}

Sample run:

OUTPUT 1:

OUTPUT 1:

30
13. Write a program to find the factorial of a number using for a statement.

ALGORITHM FLOWCHART

#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
void main()
{
clrscr();
int n,i ;
long fact;
cout<<"Enter the number: ";
cin>>n;
fact = 1;
for (i=1; i<=n; i++)
fact = fact * i;
cout<<n<<"! = "<<fact;
getch();
}

31
Sample run:

OUTPUT 1:

32
14. Write a C++ program to generate the Fibonacci sequence up to a limit using a for
statement. (Hint: 5 = 0 1 1 2 3)

ALGORITHM FLOWCHART

#include<iostream.h>
#include<conio.h>
void main( )
{
clrscr();
int num, first, second, count, third;
cout<<"Enter the number limit for Fibonacci Series"<<endl;
cin>>num;

33
first = 0;
second = 1;
cout<<first<<"\t"<<second;
third = first + second;
for( count = 2; third<=num; count++)
{
cout<<"\t"<<third;
first = second;
second = third;
third = first + second;
}
cout<<"\nTotal terms = "<<count;
getch( );
}
Sample run:

OUTPUT 1:

34
15. Write a program to find the sum and average of n number of the array.

ALGORITHM FLOWCHART

PROGRAM
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
void main( )
{
clrscr();
int a[50], i, n, sum;
float avg;
cout<<"How many elements?"<<endl;
cin>>n;
cout<<"Enter the elements:"<<endl;

35
for(i=0; i<n; i++)
cin>>a[i];
sum = 0;
for(i=0; i<n; i++)
sum = sum + a[i];
avg=(float) sum / n;
cout<<"Sum = "<<sum<<endl;
cout<<"Average = "<<avg<<endl;
getch( );
}
Sample run:

OUTPUT 1:

36
16. Write a program to arrange a list of numbers in ascending order using bubble sort.

ALGORITHM

PROGRAM
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
void main( )
{
int a[50], i, temp, j, n;
clrscr( );
cout<<"Enter the number of elements:"<<endl;
cin>>n;
cout<<"Enter the elements:"<<endl;
for(i=0; i<n; i++)
cin>>a[i];

37
for(i=1; i<n; i++)
{
for(j=0; j<n-i; j++)
if(a[j] > a[j+1])
{
temp = a[j];
a[j] = a[j+1];
a[j+1] = temp;
}
}
cout<<"The sorted elements are:"<<endl;
for(i=0; i<n; i++)
cout<<a[i]<<"\t";
getch( );
}

Sample run:

OUTPUT 1:

38
17. Write a program to find the position of a given number in the array.

ALGORITHM

1. INPUT n, ele
2. for i = 0 to n-1
INPUT a[i]
for end
3. pos = -1
4. for i = 0 to n-1
if (a[i] == ele)
pos = a[i]
GOTO 5
if end
for end
5. if (pos >= 0)
PRINT ele, “ is present at position “, pos
else
PRINT ele, “ is not present”
6. STOP

PROGRAM
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
void main( )
{
clrscr( );
int a[50], i, pos, ele, n;
cout<<"Enter the number of elements:"<<endl;
cin>>n;
cout<<"Enter the elements:"<<endl;
for(i=0; i<n; i++)
cin>>a[i];
cout<<"Enter the search element:"<<endl;
cin>>ele;
pos=-1;

39
for(i=0; i<n; i++)
if(ele == a[i])
{
pos = i;
break;
}
if(pos >= 0)
cout<<ele<<" is present at position "<<pos<<endl;
else
cout<<ele<<" is not present"<<endl;
getch( );
}

Sampe run:

40
OUTPUT 1:

OUTPUT 2:

41
18. Write a program to find the sum of each row and column separately in a given
matrix.
ALGORITHM

1. INPUT m, n
2. for i = 0 to m
for j = 0 to n
INPUT a[i][j]
for end
for end
3. for i = 0 to m-1
rsum = 0
for j = 0 to n-1
rsum = rsum + a[i][j];

for end
for end
PRINT “Sum of row-no:”, i+1, “ = “, rsum
4. for i = 0 to n-1
csum = 0
for j = 0 to m-1
csum = csum + a[j][i]
for end
PRINT “Sum of column-no:”, i+1, “ = “, csum

for end
5.STOP

PROGRAM
#include<iostream.h>
#include<conio.h>
void main( )
{
int a[5][5], r, c, i, j, rsum, csum;
clrscr( );
cout << "Enter the order of matrix: ";
cin >> r>>c;
// Storing elements of matrix entered by user.
cout << "Enter elements of the matrix: " << endl;
for (i = 0; i < r; i++)
for (j = 0; j < c; j++)
cin >> a[i][j];

42
// to find row sum
for(i = 0; i < r; i++)
{
rsum = 0;
for(j = 0; j < c; j++)
{
rsum = rsum + a[i][j];
}
cout<<"Sum of row no "<<j+1<<" = "<<rsum<<endl;
}
// to find column sum
for(j = 0; j < c; j++)
{
csum = 0;
for(i = 0; i < r; i++)
{
csum = csum + a[i][j];
}
cout<<"Sum of column no "<<i+1<<" = "<<csum<<endl;
}
getch( );
}

Sample run:

43
OUTPUT 1:

OUTPUT 2:

44
19. Write a C++ program to find the sum of two compatible matrices:
ALGORITHM

1. INPUT m1, n1
2. INPUT m2, n2
3. for i = 0 to m1 -1
for j = 0 to n1 -1
INPUT a[i][j]
for end
for end
4. for i = 0 to m2 -1
for j = 0 to n2 -1
INPUT b[i][j]
for end
for end
5. if (m1=m2 AND n1=n2)
for i = 0 to m1 -1
for j = 0 to n1 -1
s[i][j] = a[i][j] + b[i][j]
for end
for end
for i = 0 to m1 -1
for j = 0 to n1 -1
OUTPUT s[i][j]
for end
for end
else
PRINT “The matrices are not compatible”
6. STOP

PROGRAM

#include<iostream.h>
#include<conio.h>
void main( )
{
int a[5][5], b[5][5], sum[5][5], r1, c1, r2, c2, i, j;
clrscr( );
cout << "Enter the order of first matrix: ";
cin >> r1>>c1;

45
cout << "Enter the order of second matrix: ";
cin >> r2>>c2;
if ( (r1 == r2) && (c1==c2))
{
// Storing elements of first matrix entered by user.
cout << "Enter elements of 1st matrix: " << endl;
for (i = 0; i < r1; i++)
for (j = 0; j < c1; j++)
cin >> a[i][j];
// Storing elements of the second matrix entered by the user.
cout << "Enter elements of 2nd matrix: " << endl;
for(i = 0; i < r2; i++)
for(j = 0; j < c2; j++)
cin >> b[i][j];
// Adding Two matrices
for(i = 0; i < r1; i++)
for(j = 0; j < c1; j++)
sum[i][j] = a[i][j] + b[i][j];
cout << "Sum of two matrix is: " << endl;
for(i = 0; i < r1; i++)
{
for(j = 0; j < c1; j++)
{
cout << sum[i][j] << "\t"; // Displaying the resultant sum matrix.
}
cout << endl;
}
}
else
cout<<"Matrices are not compatible..."<<endl;
getch( );
}

Sample run:

46
OUTPUT 1:

OUTPUT 2:

47
20. Write a C++ program to determine whether the string is a palindrome.
ALGORITHM

1. INPUT s
2. strcpy (r, s);
3. strrev (r);
4. if(strcmpi(s, r) == 0)
PRINT "It is palindrome"
else
PRINT "It is not palindrome"
5. STOP

PROGRAM

#include<iostream.h>
#include<conio.h>
#include<string.h>
void main( )
{
char s[100], r[100]; //s is the string and r is the reserved string
clrscr( );
cout<<"Enter the String:";
cin.getline(s, 100);
strcpy (r, s); // Copy the characters of the string s to r
strrev (r); // Reverse the characters of the string r
if(strcmpi(s, r) == 0)
cout<<"It is palindrome"<<endl;
else
cout<<"It is not palindrome"<<endl;
getch( );
}

48
Sample run:

OUTPUT 1:

OUTPUT 2:

49
21. Write a C++ program to count the number of vowels and consonants in a string.

ALGORITHM

1. INPUT st
2. len = strlen(st)I
vow = 0
cons = 0
3. for i = 0 to len-1
if(isalpha(st[i]))
switch(toupper(st[i]))
{
case ‘A’:
case ‘E’:
case ‘I’:
case ‘O’:
case ‘U’: vow = vow +1
break;
default: cons=cons+1
}
if end
for end
4. PRINT vow, cons
5. STOP

PROGRAM

#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<ctype.h>
void main( )
{
char s[100];
int len, i, cons=0, vow=0;
clrscr( );
cout<<"Enter the string:";
cin.getline(s,100);
len=strlen(s);

50
for(i=0;i<len;i++)
if( isalpha (s[i]) )
switch (toupper (s[i]) )
{
case'A':
case'E':
case'I':
case'O':
case'U': vow++;
break;
default: cons++;
}
cout<<"Number of Vowles:"<<vow<<endl;
cout<<"Number of Consonants:"<<cons<<endl;
getch();
}

Sample run:

51
OUTPUT 1:

OUTPUT 2:

52
22. Write a C++ program to find the GCD and LCM of two numbers using functions.

ALGORITHM

1. INPUT a, b
2. g = gcd(a, b)
3. lcm = (a*b)/g
4. OUTPUT g, lcm
5. STOP

gcd(m,n):
1.while( n !=0)
rem = m mod n
m=n
n = rem
while end
2.return m
PROGRAM

#include<iostream.h>
#include<conio.h>
void main( )
{
int gcd(int, int); //Function Prototype
int a, b, g, lcm;
clrscr( );
cout<<"Enter two number:"<<endl;
cin>>a>>b;
g = gcd(a,b);
lcm = (a * b)/g;
cout<<"GCD of "<<a<<" and "<<b<<" is "<<g<<endl;
cout<<"LCM of "<<a<<" and "<<b<<" is "<<lcm<<endl;
getch( );
}
int gcd( int x, int y)
{
int rem;
while(y != 0)
{
rem = x % y;
x = y;
y = rem;
}
return(x);

53
}

OUTPUT 1:

OUTPUT 1:

23. Write a C++ program to find Xy using functions.

ALGORITHM

1. INPUT x, y
2. p = expo (x, y)
3. OUTPUT p
4. STOP

expo(a, b):
1. if (a = 0)

54
return 0
else
. if (b = 0)
return 1
else
. if (b > 0)
return a* expo(a, n-1)
else
return expo(a, n+1)/a

FLOWCHART

PROGRAM

#include<iostream.h>
#include<conio.h>
void main( )
{
float power(float,int);
float x;
int y;
clrscr( );
cout<<"Enter the Base and Exponent:"<<endl;
cin>>x>>y;
cout<<x<<" to the power of "<<y<<" ="<<power(x,y)<<endl;
getch( );
}
float power(float a, int n)
{
if(a==0)
return 0.0;

55
if(n==0)
return 1.0;
else if(n>0)
return(a * power(a,n-1));
else
return(power(a, n+1)/a);
}

OUTPUT 1:

OUTPUT 2:

OUTPUT 3:

OUTPUT 1:

56
OUTPUT 2:

OUTPUT 3:

57
58
24. Write a program to input the register number, name and class of all the students in a class into a
structure and output the data in a tabular manner with proper heading.
1. INPUT n
2. struct student
{
int regno
char name[20]
char class9[4]
} s[50]
3. for i = 0 to n-1
INPUT s[i].regno, s[i].name, s[i].section for
end
4. for i = 0 to n-1
OUTPUT s[i].regno, s[i].name, s[i].section
for end

5. STOP

#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
#include<string.h>
struct student
{
int regno;
char name[25];
char grade[10];
};
void main()
{
student s[50];
int i,j,n;
clrscr();
cout<<"How many students? ";
cin>>n;
for(i = 0; i < n; i++)
{
cout<<"Enter the Reg. No. of the student"<<i+1;
cin>>s[i].regno;
cout<<"Enter the name of the student"<<i+1;
cin>>s[i].name;
cout<<"Enter the class of the student"<<i+1;
cin>>s[i].grade;
}
cout<<"\t"<<"REGNO."<<"\t"<<"NAME"<<"\t"<<"CLASS"<<"\t"<<endl;
for(i = 0; i < n; i++)
cout<<"\t"<<s[i].regno<<"\t"<<s[i].name<<"\t"<<s[i].grade<<endl;
getch();
}

59
OUTPUT 1:

60
SECTION B - EXCEL

61
62
63
64
HTML PRACTICAL LIST

65
66
67
68

You might also like