You are on page 1of 43

How to Answer a Question.?!

What Would be the Expected Answer.?!

Solution to
Model Question Papers
Principles of Programming Using C
BPOPS103/ (22POP13)
WELCOME
to

VLA CREATIONS
Model
Question Paper-1
SOLUTION
A computer is a programmable electronic device that accepts raw data as input and processes it with a set of
instructions (a program) to produce the result as output
Apart from being classified by generations, computers can also be categorized by their size.
The size of a computer is often an indirect indication of its capabilities.

Supercomputers:
These are huge machines having the most powerful and fastest processors.
It uses multiple CPUsfor parallel data processing.
Speeds are measured in flops (floating-point operations per second). The
fastest operates at 34 petaflops.
They are used for weather forecasting and analysis of geological data. They
have enormous storage, use more power and generate a lot of heat. They are
used by government agencies.
Mainframes:
These are multi-user machines that support many users using the feature of time-sharing. It can
run multiple programs even with a single CPU.
The processor speed is measured in MIPS (Million instructions per second).
It is used to handle data, and applications related to organization and online transactions in banks, financial
institutions, and large corporations.
Minicomputers/Midrange computers:
It was introduced by DEC(Digital Equipment Corporation).
They can serve hundreds of users and are small enough to partially occupy a room. They
are used in smaller organizations or a department of a large one.
They are not affordable to be used at the home.

Microcomputers:
The microcomputer or PCis introduced by Apple and endorsed by IBM. This
is a single-user machine powered by a single-chip microprocessor. They are
very powerful machines having gigabytes of memory.
They are both used in standalone mode and in a network.
A microcomputer takes the form of a desktop, notebook (laptop), or netbook (smaller laptop). PCs
today are powered by 3 types of OS – windows (7, 8, or 10), Mac OS X (Apple), and Linux. They
are used for engineering and scientific applications and for software development.

Smartphones and Embedded Computers:


The smartphone is a general-purpose computer i.e., capable of making phone calls. It has a powerful processor, with multiple
cores, supports GBs of memory, and runs a developed OS (Android or iOS).
It can be operated with a keyboard, touch, or stylus.
Embedded Computers or micro-controllers are very small circuits containing a CPU, non-volatile memory, and input and output
handling facilities.
They are embedded into many machines that we use – cars, washing machines, cameras, etc. The
processor here runs a single unmodifiable program stored in memory.
• An algorithm is a set of instructions for solving a problem or accomplishing a task.

• STEP 1: Start
• STEP 2: Take radius as input from the user using std input.
• [Read radius r]
• STEP 3: Calculate the area of circle using the formula
• [ area = (3.14)*r*r ]
• STEP 4: Calculate the Circumference using the formula
• [ circumference = 2*3.14 * r]
• STEP 5: Print the area and circumference to the screen using the std output.
• STEP6: Stop
• Speed Computers can perform millions of operations per second The speed of computers is usually
given in nanoseconds and picoseconds, where 1 nanosecond = 1 × 10 −9 seconds and
1 picosecond = 1 × 10 −12 seconds.
• Accuracy: A computer is a very fast, reliable, and robust electronic device. It always gives accurate results,
provided the correct data and set of instructions are input to it.
• Automation: Besides being very fast and accurate, computers are automatable devices that can
perform a task without any user intervention. The user just needs to assign the task to the computer,
after which it automatically controls different devices attached to it and executes the program
instructions.
• Diligence: Unlike humans, computers never get tired of a repetitive task. It can continually work for
hours without creating errors. Even if a large number of executions need to be executed, each and
every execution requires the same duration, and is executed with the same accuracy.
• Versatile: Versatility is the quality of being flexible. Today, computers are used in our daily life in different fields.
• Memory: Similar to humans, computers also have memory. Just the way we cannot store everything in our
memory and need secondary media, such as a notebook, to record certain important things, computers also
have internal or primary memory (storage space) as well as external or secondary memory. While the internal
memory of computers is very expensive and limited in size, the secondary storage is cheaper and of bigger
capacity.
Variable is the name of a memory location that we use for storing data. We can change the value
of a variable in C or any other language, and we can also reuse it multiple times.
Rules for Forming Variable
• Variables cannot include any special characters or punctuation marks (like #, $, ^, ?, ., etc.)
except the underscore_.
• There cannot be two successive underscores.
• Keywords cannot be used as identifiers.
• The case of alphabetic characters that form the variable name is significant.
For example, "FIRST' is different from 'first' and 'First'.
• Variables can be a combination of characters and numbers.
i)valid vi) valid vii) invalid
ii) Invalid
iii) invalid
iv) valid
v) invalid
#include<stdio.h>
int main()
{
int p,r,t,SI;
printf(Enter principle amount, Rate of interest and time to find simple interest:);
scanf(“%d %d %d”, p, r, t);
SI=(p*r*t)/100;
printf(“Simple interest = %d”,&SI);
return 0;
}
OUTPUT
Enter principle amount, Rate of interest and time to find simple interest
18000 2 6
Simple interest: 2160
Relational operators: The operators that are used to find the relationship between two operands are called
relational operators.
The relationship between the two operand values results in true (always 1) or false (always 0).
Relational operators available in C are:
All the relational operators are having a same priority and left to right associativity.
The relational operators have lower precedence than arithmetic operators.
Logical operators
The operators that are used to combine two or more relational expressions
are called logical operators.
The output of relational expression is true or false, the output of
logical expression is also true or false.
• Logical NOT: The logical NOT operator is denoted by „!‟. The output of not operator can be true or false.
The result is true if the operand value is false and the result is false if the operand is true.
• Logical AND: The logical AND operator is denoted by „&&‟. The output of and operator is true if both the
operands are evaluated to true. If one of the operand is evaluated false, the result is false.
• Logical OR: The logical OR operator is denoted by „||‟. The output of or operator is true if and only if at
least one of the operands is evaluated to true. If both the operands are evaluated to false, the result is
false.
• Ex: Given A=10, Evaluate C=!A
• A=10 other than value 0, any value is treated as 1.
So, A=1
• C = !A
• C = !1
• C=0
#include <math.h> printf("root1 = %.2f and root2 = %.2f", root1, root2);
#include <stdio.h> }
int main( ) { // condition for real and equal roots
float a, b, c, disc, root1, root2, realPart, imagPart; else if (disc == 0) {
printf("Enter coefficients a, b and c: "); root1 = root2 = -b / (2 * a);
scanf("%f %f %f", &a, &b, &c); printf("Roots are real and equal \n");
//check for zero coefficients printf("root1 = root2 = %.2f ", root1);
if((a==0)||(b==0)||(c==0)) }
{ // if roots are not real
printf("Invalid coefficients\n"); else {
return 0; realPart = -b / (2 * a);
} imagPart = sqrt(-disc) / (2 * a);
disc = b * b - 4 * a * c; printf("Roots are imaginary \n");
// condition for real and different roots printf("root1 = %.2f+%.2fi and root2 = %.2f - %.2fi",
if (disc> 0) realPart, imagPart, realPart,imagPart);
{ }
root1 = (-b + sqrt(disc)) / (2 * a); return 0;
root2 = (-b - sqrt(disc)) / (2 * a); }
printf("Roots are real and distinct \n");
C-language provides goto statement to transfer control unconditionally to other part of the program. Although
use of goto statement is not advisable but sometime it is desirable to use go to statement. It has the following
form:
goto statement requires a label to determine where to transfer the control. A label
must end with colon (:). We can use any valid name as a label similar to variable name. When
compiler encounters goto statement with a label name then, it transfers the control to the
location where label has been defined in the program
Example: #include<stdio.h>
void main()
{
printf(“Bangalore \t”);
goto label;
printf(“is a \t”);
lable: printf(“smart city”);
}
Output:
Bangalore smart city
The „switch‟ statement is a control statement used to make a select one alternative among several alternatives.
It is a “multi-way decision statement” that tests whether an expression matches one of the case values and
branches accordingly.
Here switch, case, break and default are built-in C language words.
•If the choice matches to label1 then block1 will be executed else if it evaluates to label2 then block2 will be
executed and so on.
•If choice does not matches with any case labels, then default block will be executed
Example: case '/': result = num1 / num2;
#include <stdio.h> break;
void main() default: printf("\n You have entered an Invalid Operator
{ ");
char Operator; }
float num1, num2, result = 0; printf("\n The result of %f %c %f = %f", num1, Operator,
printf("Enter an Operator (+, -, *, /) :\n "); num2, result);
scanf("%c", &Operator); }
printf("Enter the Values for two Operands: num1 and
num2 : \n ");
scanf("%f%f", &num1, &num2);
switch(Operator)
{
case '+': result = num1 + num2;
break;
case '-': result = num1 - num2;
break;
case '*': result = num1 * num2;
break;
Refer example of 3(c) for 4(a)

Formatting Input/Output
C language supports two formatting functions printf and scanf.
printf is used to convert data stored in the program into a text stream for output to the monitor.
scanf is used to convert the text stream coming from the keyboard to data values and stores them in
program variables.
printf()
The printf function (stands for print formatting) is used to display information
required by the user and also prints the values of the variables. For this, the print function takes data
values, converts them to a text stream using formatting specifications in the control string and passes the
resulting text stream to the standard output. The control string may contain zero or more conversion
specifications, textual data, and control characters to be displayed.
printf("control string", variable list);
The function accepts two parameters-control string and variable list. The control string may also contain
the text to be printed like instructions to the user, captions, identifiers, or any other text to make the output
readable.
Examples:
printf("\n The number is %6d", 12);
O/p: The number is 12

scanf()
The scanf() function stands for scan formatting and is used to read formatted data
from the keyboard. The scanf function takes a text stream from the keyboard, extracts and formats data
from the stream according to a format control string and then stores the data in specified program
variables. The syntax of the scanf() function can be given as: scanf("control string", arg1, arg2,
arg3,….argn);
The control string specifies the type and format of the data that has to be obtained
from the keyboard and stored in the memory locations pointed by arguments arg1, arg2,, argn, i.e., the
arguments are actually the variable addresses where each piece of data is to be stored.
Ex: int num;
scanf("%d", &num);
The scanf function reads an integer value (because the type specifier is %d) into the address or the
memory location pointed by num.
if statement
The if statement is a powerful decision-making statement and is used to control the
flow of execution of statements. It is basically a two-way decision statement and is used in conjunction with an
expression. But only if statement is a one way selection which executes statements based on whether conditional
statement is true/false. Relational operators <=,<,>,= =, > = and != are used to specify conditions.
Syntax: if(test expression)
{
statement(s);
}
Example: #include<stdio.h>
void main()
{
int age;
printf(“Enter age of person:\n”);
scanf(“%d”,&age);
if(age>60)
printf(“Eligible for pension”);
}
if…else statement
The if…else statement is an extension of the simple if condition statement. if..else
statement is two way selection statement which executes statements when the conditional expression in the if is true,
if it is false then statement under else are executed.
Syntax: Example:
if(test expression) #include<stdio.h>
{ void main()
True-block statement(s) { int age;
} printf(“Enter age of person:\n”);
else scanf(“%d”,&age);
{ if(age>60)
False-block statement(s) printf(“Eligible for pension”);
} else
Statement-x printf(“Not eligible for pension”);
}

If the test expression is true, then the true block


statement(s), immediately following the if statements are
executed, otherwise, the false block statement(s) are
executed. In earlier case, either true or false block will be
executed, not both.
Call by value Call by reference
#include<stdio.h> #include<stdio.h>
int swap(int, int); int swap(int *, int *);
int main( ) int main( )
{ {
int a=5, b=10 ; int a=5, b=10 ;
swap(a, b); swap(&a, &b);
printf(“%d%d:, a, b); printf(“%d%d:, a, b);
} }
int swap(int x, int y) int swap(int *x, int *y)
{ {
int temp; int temp;
temp = x; temp = *x;
x = y; *x = *y;
y = temp; *y = temp;
} }
User-defined functions: These are written by programmers for their own purpose and are not readily
available.
There are three elements that are related to functions:
i. Function definition
ii. Function call
iii. Function declaration/Function prototype
i. Function definition: It is an independent program module that is specially written to implement the
requirements of the function.
ii. Function call: The function should be invoked at a required place in the program which is called as
Function call.
The program/function that calls the function is referred as calling program or calling function.
The program/function that is called by program/function is referred as called program or called
function.
iii. Function declaration: The calling program should declare any function that is to be used later in the
program which is called as function declaration.
Note :[ For Example program refer 5(a) answer call by value program]
#include<stdio.h> printf("Enter %d elements into matrix A\n",(m*n));
int main() //input elements
{ for(int i=0;i<m;i++)
int m,n; int p,q; for(int j=0;j<n;j++)
printf("Enter the value of M and N\n"); scanf("%d",&a[i][j]);
//input order of matrix A printf("Enter %d elements into matrix B\n",(p*q));
scanf("%d%d",&m,&n); //input elements
printf("Enter the value of P and Q\n"); for(int i=0;i<p;i++)
//input order of matrix B for(int j=0;j<q;j++)
scanf("%d%d",&p,&q); scanf(“%d”,&b[i][j]);
//declare, and define arrays a,b,c //compute product
int a[m][n]; for(int i=0;i<m;i++)
int b[p][q]; {
int c[m][q]; for(int j=0;j<q;j++) {
//check the matrices order for compatibility c[i][j]=0;
if(n!=p) for(int k=0;k<n;k++)
{ c[i][j]+=a[i][k]*b[k][j]; //End of inner loop
printf("Invalid order\n"); } }
return 0; }
//output matrix A }
printf("Matrix A\n"); //output resultant matrix C
for(int i=0;i<m;i++) printf("Matrix C\n");
{ for(int i=0;i<m;i++)
for(int j=0;j<n;j++) {
{ for(int j=0;j<q;j++)
printf("%-4d",a[i][j]); {
} printf("%-4d",c[i][j]);
printf("\n"); }
} printf("\n");
//output matrix B }
printf("Matrix B\n"); return 0;
for(int i=0;i<p;i++) }
{
for(int j=0;j<q;j++)
{
printf("%-4d",b[i][j]);
}
printf("\n");
A function calling itself repeatedly is called Recursion. for ( c = 1 ; c <= n ; c++ )
All recursive functions have two elements each call {
either solves one part of the problem or it reduces printf("%d\n", Fibonacci(i));
the size of the problem. i++;
The statement that solves the problem is known as }
base case. }
The rest of the function is known as general case. int Fibonacci(int n)
Example {
#include<stdio.h> if ( n == 0 )
int Fibonacci(int); return 0;
void main() else if ( n == 1 )
{ return 1;
int n, i = 0, c; else
printf(" Enter the number of terms"); return (Fibonacci(n-1) + Fibonacci(n-2));
scanf("%d",&n); }
printf("Fibonacci series\n");
a) Initialization with size: we can initialize values to all the elements of the array.
Syntax: data_type array_name[array_size]={list of values};
Examples: int marks[4]={ 95,35, 67, 87};
b) Initialization without size: We needn’t have to specify the size of array provided we are initializing
the values in beginning itself.
Syntax: data_type array_name[ ]={list of values};
Examples: int marks[ ]={ 95,35, 67, 87};
Run time initialization: Run time initialization is storing values in an array when program is
running or executing.
Example: printf(“Enter 4 marks”);
for(i=0; i<4; i++) {
scanf(“ %d”, &marks*i+); }
Declaration of Two-Dimensional Array: Here is general syntax for array declaration along with examples.
Syntax: data_type array_name[row_size][column_size];
Examples: int marks[4][4];
float city_temper[3][3];
Initialization of Two-Dimensional Array: After array is declared, next is storing values in to an array is
called initialization. There are two types of array initialization:
1. Compile-time initialization 2. Run-time initialization
1. Compile time initialization: If we assign values to the array during declaration it is called compile
time initialization.
Syntax: data_type array_name[row_size][column_size]={list of values};
Examples: int marks[3][4]={ 1,2,3, 4, 5, 6, 7,8,9,10,11,12};
Run time initialization: Run time initialization is storing values in an array when program is
running or executing.
Following example illustrates run time storing of values using scanf and for loop:
Example: printf(“Enter the marks”);
for(i=0; i<3; i++)
for(j=0;j<3;j++) {
scanf(“ %d”, &marks*i+*j+); }
Strcat Function Strncat Function
Syntax: char *strcat( char *str1,const char str2); Syntax: char *strncat( char *str1,const char str2, size_t n);
The strcat function appends the string pointed to by str2 This function appends the string pointed to by str2 to
to the end of the string pointed to by str1.The process the end of the string pointed to by str1 upto n characters
stops when the terminating null character of str2 is long. Copying stops when n characters are copied or the
copied. terminating null character of str2 is copied.
Strlen Function Strcpy Function
Syntax: size_t strlen(const char *str); Syntax: char *strcpy(char *str1, const char *str2);
This function calculates the length of the string str This function copies the string pointed to by str2 to
up to but not including the null character, i.e., the str1 including the null character of str2. It returns
function returns the number of characters in the the argument str1. Here str1 should be big enough
string. to store the contents of str2 .
scanf(): gets()
It is an formatted input function gets() is an unformatted input function
The function scanf is used to read formatted data from the Used to read the string inputs
keyboard Declaration: gets(str);
Syntax: Helps to scan a line of text from a standard input device
scanf(f “control string”, arg1,arg2,……argn); Ex: void main()
where, {
Control string specifies the type and format of the data Char a[20];
that as to be obtained from the keyboard and stored in the Printf(“Enter a string”);
memory locations pointed to by the arg1, arg2,……argn. gets(a);
Example: Int num1; Printf(“\n output=%s”,a); }
Scanf(“%d”, &num1); Reads data untill encounters a newline character.
#include<stdio.h> printf("Largest is : %d", *pb);
}
int main() else
{ {
int a,b,c,*pa, *pb, *pc; printf("Largest = %d", *pc);
printf("Enter three numbers:\n"); }
scanf("%d%d%d", &a,&b,&c); return 0;
}
/* Referencing */
pa= &a; OUTPUT:
pb= &b; Enter three numbers
pc= &c; 12
if(*pa > *pb && *pa > *pc) 33
{ 17
printf("Largest is: %d", *pa); Largest = 33
}
else if(*pb > *pc && *pb > *pc)
{
Actually pointers are nothing but memory addresses. Example
● A pointer is a variable that contains the memory #include<stdio.h>
location of another variable. int main()
DECLARING POINTER VARIABLES {
● The general syntax of declaring pointer variable is int num, *pnum;
data_type *ptr_name; pnum = &num;
Here, data_type is the data type of the value that the printf(“\n Enter the number : “);
pointer will point to. scanf(“%d”, &num);
For example: printf(“\n The number that was entered is : %d”, *pnum);
int *pnum; char *pch; float *pfnum; return 0;
int x= 10; }
int *ptr = &x; OUTPUT:
The '*' informs the compiler that ptr is a pointer variable Enter the number : 10
and the int specifies that it will store the address of an
integer variable. The number that was entered is : 10
The & operator retrieves the lvalue (address) of x, and
copies that to the contents of the pointer ptr.
• NULL POINTERS ● The generic pointer, can be pointed at variables of any
• A null pointer which is a special pointer value that is data type.
known not to point anywhere. This means that a NULL ● It is declared by writing
pointer does not point to any valid memory address. void *ptr;
• To declare a null pointer you may use the predefined ● You need to cast a void pointer to another kind of pointer
constant NULL, before using it.
• int *ptr = NULL; ● Generic pointers are used when a pointer has to point to
• You can always check whether a given pointer variable data of different types at different times.
stores address of some variable or contains a null by For ex,
writing, #include<stdio.h>
• if ( ptr == NULL) int main()
• { Statement block; { int x=10;
• } char ch = „A‟;
• Null pointers are used in situations if one of the pointers void *gp;
in the program points somewhere some of the time but
not all of the time. In such situations it is always better gp = &x; printf("\n Generic pointer points to the integer
to set it to a null pointer when it doesn't point value = %d", *(int*) gp);
anywhere valid, and to test to see if it's a null pointer gp = &ch; printf("\n Generic pointer now points to the
before using it. character %c", *(char*) gp);
return 0;
GENERIC POINTERS }
● A generic pointer is pointer variable that has void as its OUTPUT:
data type. Generic pointer points to the integer value = 10
After defining a structure format we can -------
declare variable for that type. -------
It includes the following elements: datatype member n;
i.Keyword struct };
ii. A structure or tagname struct tagname list_of_variables;
iii. List of variables separated by comma Structure to store book information
iv. Terminating semicolon struct bookbank
Syntax: struct tagname list_of_variables; {
Example: struct bookbank book1, book2; char author[50];
struct student s1, s2; char title[50];
int year;
Syntax of structure variable declaration float price;
struct tagname };
{ struct bookbank book1, book2;
datatype member 1;
datatype member 2;
Structure Union
• The keyword struct is used to define a structure • The keyword union is used to define a union
• It is a collection of heterogeneous elements of • Size of union is equal to the size of largest member.
different data type. • Memory allocated is shared by individual members of
• Each member within in a structure is assigned a unique union.
storage area of location. Size of structure is equal to the • Altering the value of any of the member will alter other
sum of sizes of its members. members value
• Altering the value of a member will not affect the other • Only one member can be accessed at a time
members of the structure • Only the first member of a union can be initialized.
• Individual members can be accessed at a time • Syntax: union tag_name
• Several members of a structure can initialize at once. • {
• Syntax: struct struct_name data-type member1;
• { data-type member2;
data-type member1; data-type membern;
data-type member2; };
data-type membern;
};
Example can also be included
#include<stdio.h> printf("File error!");
typedef struct exit(1);
{ }
char name[30]; printf("Enter how many records:\n");
int id; scanf("%d",&n);
int salary; /* Reading from file and storing them in structure
}employee; array */
int main() for(i=0;i < n;i++)
{ {
int n,i,j; fread(&e[i],sizeof(e[i]),1, fptr);
FILE *fptr; }
employee e[10], temp;
/* Reading file in binary read mode */
fptr = fopen("employee.txt","rb");
if(fptr == NULL)
{
/* Sorting */
for(i=0;i< n-1;i++)
{
for(j=i+1;j< n;j++)
{
if(e[i].salary>e[j].salary)
{
temp = e[i];
e[i] = e[j];
e[j] = temp;
} } }
/* Displaying sorted list */
for(i=0;i< n;i++)
{
printf("Name = %s\t Id = %d\t Salary = %d\n",e[i].name, e[i].id, e[i].salary);
}
fclose(fptr);
return 0;
}
Modes of File • The various features of this mode are
The various mode in which a file can be opened/created • If file does not exist, a new file is created.
are: • If a file already exists with the same name, the
Mode Meaning contents of the file are erased and the file is considered
“r” opens a text file for reading. The file must exist. as a new empty file.
“w” creates an text file for writing. • The file pointer points to the beginning of the file.
“a” Append to a text file iii Append Mode(“a”)
i) Read Mode(“r”) • This mode is used to insert the data at the end of the
• This mode is used for opening an existing file to existing file.
perform read operation. • The various features of this mode are
• The various features of this mode are • Used only for text file.
• Used only for text file • If the file already exist, the file pointer points to end of
• If the file does not exist, an error is returned the file.
• The contents of the file are not lost • If the file is does not exist. A new file is created.
• The file pointer points to beginning of the file. • Existing data cannot be modified.
ii) Write Mode(“w”)
• This mode is used to create a file for writing.
gets() fgets()
gets() is an unformatted input function It is used to read a string from file and store in memory.
Used to read the string inputs Syntax: ptr=fgets(str,n,fp); Where
Declaration: gets(str); fp  file pointer which points to the file to be read
Helps to scan a line of text from a standard input device Str string variable where read string will be stored
Ex: void main() n  number of characters to be read from file
{ ptr  If the operation is successful, it returns a pointer to
Char a[20]; the string read in.
Printf(“Enter a string”); otherwise, it returns NULL.
gets(a); The returned value is copied into ptr.
Printf(“\n output=%s”,a); } Reads data untill it either encounters a newline or exceeds
Reads data untill encounters a newline character. the specified buffer length.
Void main()
{ int max=80;
Char store[max];
Fgets(store,max,stdin);
Printf(“output=%s”,store); }
#include <stdio.h> {
#include <stdlib.h> printf("\nUSN: %s\n",s[i].usn);
struct student printf("Name: %s\n ", s[i].name);
{ printf("Marks: %d",s[i].marks);
char usn[50]; printf("\n"); }
char name[50]; for(i=0;i<n;i++) {
int marks; sum=sum+s[i].marks;
} s[10]; }
void main() { average=sum/n;
int i,n,countav=0,countbv=0; printf("\nAverage marks: %f",average);
float sum,average; for(i=0;i<n;i++) {
printf("Enter number of Students\n"); if(s[i].marks>=average)
scanf("%d",&n); countav++;
printf("Enter information of students:\n"); else
// storing information countbv++;
for(i=0; i<n;i++) }
{ printf("\nTotal No of students above average= %d",countav);
printf("Enter USN: "); scanf("%s",s[i].usn); printf("Enter name: "); printf("\nTotal No of students below average= %d",countbv);
scanf("%s",s[i].name); printf("Enter marks: "); scanf("%d",&s[i].marks); }
printf("\n"); }
printf("Displaying Information:\n\n");
// displaying information
for(i=0; i<n; i++)
THANK YOU

All The Best For Exams….

Click For Videos:https://www.youtube.com/VLAcreations

You might also like