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

c Program

Uploaded by

aryan25wes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

c Program

Uploaded by

aryan25wes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 88

C-PROGRAMMING ALL PROGRAMS

# PROGRAM 1
#ALGORITHM
1 Start
2 print Name: Aryan Amit Wesavkar
3 Print Class: FE
4 Print Division: D
5 Print Roll no: 51
6 Print College name: K.C. College of Engineering
#FLOWCHART
#Code
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("Name:Aryan Amit Wesavkar\n");
printf("Class:FE\n");
printf("Division:D\n");
printf("Roll no.:51\n");
printf("College name: K.C. College of Engineering\n");
getch();
}

#Output
#PROGRAM 2
#ALGORITHM
I Start
2 Read the two numbers and store in a and b
3 Sum = a+b
4 Print “sum is addition of a &b”
5 Sub= a-b
6 Print “sub is subtraction of a &b”
7 mult = a*b
8 Print “mult is multiplication of 0&b”
9 div = a/b
10 Print “div is division of “
11 Stop

#FLOWCHART
#CODE
#include<stdio.h>
#include<conio.h>
void main()
{
int p,q;
int sum,sub,mul,mod;
float div;
clrscr();
printf("Enter The numbers:\n");
scanf("%d%d", &p, &q);
sum=p+q;
sub=p-q;
mul=p*q;
div=(float)p/q;
mod=p%q;
printf("\n");
printf("Addition of %d+%d=%d\n",p,q,sum);
printf("Subtraction of %d-%d=%d\n",p,q,sub);
printf("Multiplication of %d*%d=%d\n",p,q,mul);
printf("Division of %d/%d=%f\n",p,q,div);
printf("Modulus of %d %% %d=%d\n",p,q,mod);
getch();
}

OUTPUT
#PROGRAM 3
#ALGORITHM
1 Start
2 Read the radius of circle, store in r
3 area= 3.142*r*r
4 Print “area of circle”.
5 Read value of I and b from user
6 Perimeter = 2*(1+b)
7 Print “perimeter of rectangle”
8 Stop
#FLOWCHART
#CODE
#include<stdio.h>
#include<conio.h>
#define PI 3.14
void main()
{
float radius,length,breadth,circleArea,rPerimeter;
clrscr();
printf("Enter the radius of circle:\n");
scanf("%f",&radius);
circleArea=PI*radius*radius;
printf("The area of circle is:%2f\n",circleArea);
printf("Enter the length of rectangle:\n");
scanf("%f",&length);
printf("Enter the breadth of rectangle:\n");
scanf("%f",&breadth);
rPerimeter=2*(length+breadth);
printf("Perimeter of the rectangle:%2f\n",rPerimeter);
getch();
}

#OUTPUT
#PROGRAM 4
#ALGORITHM 1
1 Start
2 Take input &b
3 A=a+b
4 b=a-b
5 a=a-b
6 Print “a & b”
7 Stop
#ALGORITHM 2
1 Start
2 int a, b, c
3 Input a and b
4 c=a
5 a=b
6 b=c
7 Print “a & b”
8 Stop

#FLOWCHART 1
#FLOWCHART 2
#CODE 1
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,t;
clrscr();
printf("Enter any two integers");
scanf("%d %d",&a,&b);
printf("Integers before swapping \n a=%d \n b=%d",a,b);
t=a;
a=b;
b=t;
printf("\n Number after swapping\n a=%d \n b=%d,",a,b);
getch();
}
#OUTPUT 1
#CODE 2
#include<stdio.h>
#include<conio.h>
void main()
{

int a,b;
clrscr();
printf("Input Value of a & b:");
scanf("%d %d",&a,&b);
printf("Values of a and b before swapping: %d %d",a,b);
a=a+b;
b=a-b;
a=a-b;
printf("\n Values of a & b after swapping are:%d %d",a,b);
getch();
}

#OUTPUT
#PROGRAM 5
#ALGORITHM
1 Start
2 Input xry
3 g =x&y
4 print “g”
5 g=x/y
6 print “g”
7 g=x*y
8 g=~x
9 print”g”
10 g=x<<2
11 print “g”
12 g<<2
13 print “g”
14 Stop
#FLOWCHART
#CODE
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("Enter two numbers:");
scanf("%d %d",&a,&b);
c=a/b;
printf("The Bitwise OR operator=%d\n",c);
c=a&b;
printf("The Bitwise AND operator=%d\n",c);
c=a^b;
printf("The Bitwise XOR operator=%d\n",c);
printf("The Bitwise shift right operator=%d %d\n",a>>1,b>>1);
printf("The Bitwise shift left operator=%d %d\n",a<<1,b<<1);
printf("The Bitwise not operator for a=%d\n",~a);
printf("The Bitwise not operator for b=%d\n",~b);
getch();
}
#OUTPUT
#PROGRAM 6
#ALGORITHM
1 Start
2 int a,b
double d
3 input a input and b
4 d = (double) a/ (double) b
5 print “d”
6 Stop
#FLOWCHART
#CODE
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
float c;
clrscr();
printf("Enter the two numbers");
scanf("%d %d",&a,&b);
c=(float)a/(float)b;
printf("%d %d=%d",a,b,c);
getch();
}
#OUTPUT
#PROGRAM 7
#ALGORITHM
1Start
2 Input a,b,c
3 Discriminant =b*b-4 *a*c
4 If Discriminant <o
Yes, real port = -b/(2*a)
Imaginary part =sqrt(-discriminant)/(2*a)
Display imaginary roots
No, root 1 = (-b+ sqrt(discriminant)/(2*a)
root 2 = (-b-sqrt (discriminant)/(2*a)
Display Roots
5 Stop
#FLOWCHART
#CODE

#include<stdio.h>
#include<conio.h>
void main()
{
double a,b,c,dis,r1,r2,ip,rp;
clrscr();
printf("Enter coefficients(a,b,c):");
scanf("%lf %lf %f",&a,&b,&c);
dis=b*b-4*a*c;
if(dis>=0)
{
r1=(-b+sqrt(dis))/(2*a);
r2=(-b-(sqrt(dis)))/(2*a);
printf("Roots are %2lf & %2lf \n",r1,r2);
}
else{
rp=-b/(2*a);
ip=sqrt(-dis)*(2*a);
printf("Roots are complex:%2lf+%2lf; & %2lf-%2lf;\n",rp,ip,rp,ip);
}
getch();
}
#OUTPUT
#PROGRAM 8
#ALGORITHM

1) Start
2) Input year
3) If year%4 == 0
4) Yes, go to step 4
No, print not leap year
5) If year%100 or
400 ==0
6) yes, print leap year
No, not leap year
7) display result
8) Stop
#FLOWCHART
#CODE
#include<stdio.h>
#include<conio.h>
void main(){
int year;
clrscr();
printf("Enter the year:");
scanf("%d",&year);
if((year%4==year%100!=0)||(year%400==0))
{printf("%d is a leap year\n",year);
}else
{printf("%d is not leap year\n",year);
getch();
}}
#OUTPUT
#PROGRAM 9
#ALGORITHM

1) Start
2) Read the colour as R O G
3) Using else if ladder
a. If R then print
Red signal:”stop”
b. If Y then print
“yellow signal:caution”
c. If G then print
“green: go”
4) Stop
#FLOWCHART

#CODE
#include<stdio.h>
#include<conio.h>
void main()
{
char co;
clrscr();
printf("Enter traffic color(R,O,G):\n");
scanf("%c",&co);
if(co=='R')
{
printf("RED SIGNAL:STOP");
}
else if(co=='O')
{printf("ORANGE SIGNAL:CAUTION");
}
else if(co=='G')
{printf("GREEN SIGNAL:GO");
}
else
{printf("\nInvalid Signal Choice");
}
getch();
}

#OUTPUT
#PROGRAM 10
#ALGORITHM

1) Start
2) Read input from user
3) Use switch case:
Case I:
if user then print:” Monday”
Case II:
if user input 2 then print:” TUESDAY”
Case III:
if user input 3 then print:” WEDNESDAY”
case IV:
if user input 4 then print:” THURSDAY”
case V:
if user input 5 then print:” FRIDAY”
case VI:
if user input 6 then print: “SATURDAY”
case VII:
if user input 7 then print: “SUNDAY”
case VIII:
if user input any other number then print: invalid input
4) Stop
#FLOWCHART
#CODE
#include<stdio.h>
#include<conio.h>
void main()
{
int week;
clrscr();
printf("\nEnter the week day no.(1-7):");
scanf("%d",&week);
switch(week)
{
case 1: printf("\nMonday");
break;
case 2: printf("\nTuesday");
break;
case 3: printf("\nWednesday");
break;
case 4: printf("\nThursday");
break;
case 5: printf("\nFriday");
break;
case 6: printf("\nSaturday");
break;
case 7: printf("\nMonday");
break;
default : printf("\nInvalid week day no.");
}
getch();
}
#OUTPUT
#PROGRAM 11
#ALGORITHM

1) Start
2) Read the number of rows and store it in rows
3) Print “*” in the given number of rows
4) stop

#FLOWCHART
#CODE
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,r;
clrscr();
printf("Enter no. of rows:\n");
scanf("%d",&r);
for(i=1;i<=r;++i)
{for(j=1;j<=i;++j)
{
printf("*");}
printf("\n");
}
getch();
}

#OUTPUT
#PROGRAM 12
#ALGORITHM

1) Start
2) Read n
Set s = 0
3) For i = 1
a. If(n%i) = 0 ; then
s = s +1 ;
if s = = n
then print “given no is perfect no”
else
print” the given no is not perfect “
4) Stop

#FLOWCHART
#CODE
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,s;
clrscr();
printf("Input the number:");
scanf("%d",&n);
s=0;
printf("The positive divisiors:");
for(i=1;i<n;i++)
{
if(n%i==0)
{
s=s+i;
printf("%d",i);
}}
printf("\n The sum of divisors is:%d",s);
if(s==n)
printf("\nSo,the number is perfect\n");
else
printf("\nSo, the number is not perfect\n");
getch();
}

#OUTPUT
#PROGRAM 13
#ALGORITHM
1. Start
2. Read n,rev,rem as the variables
3. If n=0,rem=n
4. If n>0, then,
A;Yes then,
Rem=n%10
Rev=rev*10+rem
Num=num/10
OR
B: Print “Reversed number is”
5. Stop

#FLOWCHART
#CODE
#include<stdio.h>
#include<conio.h>
void main()
{
int num,revnum=0,rem;
clrscr();
printf("Enter the number:\n");
scanf("%d",&num);
while(num!=0)
{
rem=num%10;
revnum=revnum*10+rem;
num=num/10;
}
printf("The reversed number is:%d",revnum);
getch();
}
#OUTPUT
#PROGRAM 14
#Algorithm

1. Start
2. Check whether the number is
A. Perfect
B. Armstrong
C. Prime
D. By the rules of perfect number
3. Stop
#FLOWCHART
#CODE
#include<stdio.h>
#include<conio.h>
int checkPrime(int n)
{
int i;
for(i=2;i<=n/2;i++)
{
if(n%i==0)
{
return 0;
}
}
return 1;
}
int checkArmstrong(int n)
{
int ogNum,rem,sum=0;
ogNum=n;
while(n!=0)
{
rem=n%10;
sum=rem*rem*rem;
n/=10;
}
if(sum==ogNum)
{
return 1;
}
else
{
return 0;
}
}
int checkPerfect(int n)
{
int i,sum=0;
for(i=1;i<n;i++)
{
if(n%i==0)
{
sum=i;
}}
if(sum==n)
{
return 1;
}
else
{
return 0;
}
}
void main()
{
int n;
clrscr();
printf("Enter a number:");
scanf("%d",&n);
if(checkPrime(n))
{
printf("%d is a prime number.\n",n);
}
else
{printf("%d is not a prime number.\n",n);
}
if(checkArmstrong(n))
{
printf("%d is an Armstrong Number.\n",n);
}
else
{printf("%d is not Armstrong Number.\n",n);}
if(checkPerfect(n))
{
printf("%d is Perfect number.\n",n);
}
else
{
printf("%d is not a perfect number.\n",n);
}
getch();
}
#OUTPUT
#PROGRAM 15
#ALGORITHM
1. Start
2. Take input from user and read as n1,n2
3. Print largest number as larg(n1,n2)
Here,
Int larg(int a,int b)=
1=a>b?a:b
4. Print smallest number as minm(n1,n2)
Here,
Int minm( int a, int b)=
M=a<b?a:b
5. Stop
#FLOWCHART
#CODE
#include<stdio.h>
#include<conio.h>
int larg(int a, int b)
{
int l;
l=a>b?a:b;
return l;
}
int minm(int a, int b)
{
int m;
m=a<b?a:b;
return m;
}
void main()
{
int n1,n2;
clrscr();
printf("Enter two numbers:");
scanf("%d %d",&n1,&n2);
printf("\nLargest number is:%d",larg(n1,n2));
printf("\nSmallest number is:%d",minm(n1,n2));
getch();
}
#OUTPUT
#PROGRAM 16
#ALGORITHM
1. Start
2. Enter the number
3. Read as n
X=fact(n)
4. If n==0
True, return 1;
Else,
return(n*(n-1))
5. Print the number
6. Stop
#FLOWCHART
#CODE
#include<stdio.h>
#include<conio.h>
int fibo(int num);
void main()
{
int num,fib;
clrscr();
printf("Enter the number to find the nth fibonnaci term:");
scanf("%d",&num);
fib=fibo(num);
printf("%dth fibonnaci term is %d",num,fib);
getch();
}
int fibo(int num)
{
if(num==0)
return 0;
else if(num==1)
return 1;
else
return fibo(num-1)+(num-2);
}
#OUTPUT
#PROGRAM 17
#ALGORITHM
#FLOWCHART

#CODE
#include <stdio.h>
#include<conio.h>
int fibo(int num);
void main()
{
int num, fibonacci;
printf("Enter any number to find nth fiboacci term: ");
scanf("%d", &num);
fibonacci = fibo(num);
printf("%d fibonacci term is %d", num, fibonacci);
getch();
}
int fibo(int num)
{
if(num == 0)
return 0;
else if(num == 1)
return 1;
else
return fibo(num-1) + fibo(num-2);
}

#OUTPUT
#PROGRAM 18
#ALGORITHM
1. START
2. INTIALIZE arr[]=(5,2,8,7,1)
3. SET temp=0
4. Length=sizeof(arr)/sizeof9arr[0])
5. PRINT ”Elements of Original Array”
6. SET i=0 REPEAT STEP 7 and STEP 8 UNTIL i<length
7. PRINT arr[i]
8. i=i+1
9. SET i=0 REPEAT STEP 10 to STEP UNTIL i<n
10. SET j=i+1. REPEAT STEP 11 UNTIL j<length
11. If(arr[i]>arr[j]) then
temp= arr[i]
arr[i]=arr[j]
arr[j]=temp
12. J=j+1
13. I=i+1
14. PRINT new line
15. PRINT “Elements of array sorted in ascending order”
16. SET i=0 . REPEAT STEP 17 and Step 18 UNTIL i<length
17. PRINT arr[i]
18. i=i+1
19. return 0
20. END

#FLOWCHART
#CODE
#include<stdio.h>
#include<conio.h>
void main()
{
int num[20];
int i,j,a,n;
clrscr();
printf("Enter the number of elements in a array:");
scanf("%d", &n);
printf("Enter the elements:");
for(i=0;i<n;++i)
scanf("%d",&num[i]);
for(i=0;i<n;++i)
{
for(j=i+1;j<n;++j)
{
if(num[i]>num[j])
{
a=num[i];
num[i]=num[j];
num[j]=a;
}}}
printf("The numbers in ascending order is:");
for(i=0;i<n;++i)
{
printf("%d",num[i]);
}
getch();
}

#OUTPUT
#PROGRAM 19
#ALGORITHM
1. START
2. Declare matrix mat[r1][c1];mat2[r2][c2];
And matrix multi[r1][c2];r=no. of rows, c=no. of columns
3. Read mat1[r1][c1] and mat2[r2][c2]
4. Declare variable i=0,j-=0
5. Set a loop from i=0 to i=r1
6. Set an inner loop for above from j=0 to j=c2
 Intailize the value of the element (I,j) of the new matrix (mul[r1][c2]
 Set an inner loop int the above loop from k=0 to k=r1
 Using the add a sign operator(+=) store the value of mat[i][k]*mat[i][j]
 Print (mul)result
7. STOP
#FLOWCHART
#CODE
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10][10], b[10][10], res[10][10];
int aR,aC,bR,bC;
int i,j,k,sum;
clrscr();
printf("Enter the number of rows and columns for first matrix:");
scanf("%d%d",&aR, &aC);
printf("Enter the number of rows and columns for second matrix:");
scanf("%d%d",&bR,&bC);
if (aC!=bR){
printf("Matrix multiplication is not possible!");
getch();}
printf("Enter elements of first matrix:\n");
for(i=0;i<aR;i++){
for(j=0;j<aC;j++){
scanf("%d",&a[i][j]);
}}
printf("Enter elements of second matrix:\n");
for(i=0;i<bR;i++){
for(j=0;j<bC;j++){
scanf("%d",&b[i][j]);
}}
for(i=0;i<aR;i++){
for(j=0;j<bC;j++){
sum=0;
for(k=0;k<aC;k++){
sum=a[i][k]*b[k][j];}
res[i][j]=sum;
}}
printf("Resultant matrix:\n");
for(i=0;i<aR;i++){
for(j=0;j<bC;j++){
printf("%d\t",res[i][j]);
}
printf("\n");
}
getch();
}
#OUTPUT
#PROGRAM 20
#ALGORITHM
1. START
2. Read the string from the user
3. Calculate the length of string
4. Intialize rev=“ ”
5. Initialize i=length-1
6. Repeat until i>=0:
6.1 rev=rev+character
6.2 i=i-1
7. If string = rev:
7.1 Print “Given string is palindrome”
8. Else
8.1: Print “Given string is not palindrome”
9. Stop
#FLOWCHART
#CODE
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char string1[20];
int i,length,chk;
int flag=0;
clrscr();
do
{
printf("\nEnter a string:");
scanf("%s",string1);
length=strlen(string1);
for(i=0;i<length;i++)
{
if(string1[i]!=string1[length-i-1])
{
flag=1;
break;
}}
if(flag)
{
printf("%s is not a palindrome",string1);
}
else
{
printf("%s is a palindrome",string1);
}
printf("\nPress 1 to continue:");
scanf("%d",&chk);
}while(chk==1);
getch();
}
#OUTPUT
#PROGRAM 21
#ALGORITHM
1 Start

2 Define structure bookdetail with members bookname, author, number of pages, price.

3 Initialise structure array b from structure bookdetail of size 20

4 Define int num, i, t.

5 Print “Enter number of books: ”

6 Read num

7 i=0

If i<num

Print “Enter Book name: ”

Read b[i].name

Print “Enter the author of the book: ”

Read b[i].author

Print “Enter the pages of book: ”


Read b[i].pages

Print “Enter the price of book: ”

Read b[i].price

i++

8 Initialise structure array v from structure bookdetail

9 i=0, t=1

i<n

Print “Book No:”

Print “Book Name is=”

Print “Book Author is=”

Print “Book Pages is=”

Print “Book price is=”

i++

10 Stop
#FLOWCHART
#CODE
#include<stdio.h>
#include<conio.h>
#include<string.h>
#define SIZE 20
struct bookdetail
{
char name[20];
char author[20];
int pages;
int price;
};
void output(struct bookdetail v[],int n);
void main()
{
struct bookdetail b[SIZE];
int num,i;
clrscr();
printf("Enter the Numbers of Books:");
scanf("%d",&num);
printf("\n");
for(i=0;i<num;i++)
{
printf("\nBook %d Detail:=\n",i+1);
printf("Enter the Book Name:\n");
scanf("%s",b[i].name);
printf("Enter the Author of Book:\n");
scanf("%s",b[i].author);
printf("Enter the Pages of Book:\n");
scanf("%d",&b[i].pages);
printf("Enter the Price of Book:\n");
scanf("%d",&b[i].price);
}
output(b,num);
getch();
}
void output(struct bookdetail v[],int n)
{
int i,t=1;
for(i=0;i<n;i++,t++)
{
printf("\n");
printf("Book No.%d\n",t);
printf("Book %d Name is=%s \n",t,v[i].name);
printf("Book %d Author is=%s \n",t,v[i].author);
printf("Book %d Pages is=%d \n",t,v[i].pages);
printf("Book %d Price is=%d \n",t,v[i].price);
printf("\n");
}
}

#OUTPUT
#PROGRAM 22
#ALGORITHM
1 Start
2 Define union quantity with members qty, i
3 Define structure goods with members name, price, union of quality q
4 Initialise structure goods as g
5 Print “Enter number of items: ”
6 Read n
7 i=0
If i<n
Print “Item name:”
Read g[i].name
Print “Price:”
Read g[i].price
Print “Quantity in kg:”
Read g[i].q.qty
i++
8 Print “Details of items:”
9 i=0
If i<n
Print “Item name:”
Print “Quantity:”
Print “Price:”
10 Stop
#FLOWCHART
#CODE
#include<stdio.h>
#include<conio.h>
union quantity
{
int qty,i;
};
struct goods
{
char name[50];
int price;
union quantity q;
};
void main()
{
struct goods g[10];
int i,n;
clrscr();
printf("\n Enter number of items:");
scanf("%d",&n);
printf("\n Enter details:");
for(i=0;i<n;i++)
{
printf("\nItem name:");
scanf("%s",&g[i].name);
printf("\nPrice:");
scanf("%d",&g[i].price);
printf("\nQuantity in kg:");
scanf("%d",&g[i].q.qty);
}
printf("\n Details of item:");
for(i=0;i<n;i++)
{
printf("\n Item Name:%s",g[i].name);
printf("\n Quantity:%d",g[i].q.qty);
printf("\n Price:%d",g[i].price);
}
getch();
}

#OUTPUT
#PROGRAM 23
#ALGORITHM
1. Intialize two variables x,y temp and two pointers *a and *b
2. Enter the two numbers and store it in x and y.
3. Display the numbers you have entered.
4. Store the address of X and Y to ‘a’ and ‘b’ respectively.
5. Store the value in b to temp
6. Store the value of a to b pointer
7. Store the value of temp to a pointer
8. Display the numbers after swapping by using pointers a & b
9. Stop
#FLOWCHART
#CODE
#include<stdio.h>
#include<conio.h>
void swap(int*,int*);
void main()
{
int a,b;
clrscr();
printf("Enter values for a and b\n");
scanf("%d%d",&a,&b);
printf("\n\nBefore swapping:a=%d and b=%d\n",a,b);
swap(&a,&b);
printf("\nAfter swapping:a=%d and b=%d\n",a,b);
getch();
}
void swap(int*x,int*y)
{
int temp;
temp=*x;
*x=*y;
*y=temp;
}

#OUTPUT
#PROGRAM 24
#ALGORITHM
1. START
2. Enter the number of students
3. P=(float*) malloc( nt sizeof(float))
4. if (p=NULL)
 True, memory allocation failed
 Stop
5. False, input marks of students i++.
 For(i=0;i<n;i++)
True, p+I,
6. Input marks of students i+1,
 If Step 5 , No, then,
7. for(i=0;i<n;i++)
•Yes, sum+=*(p+i);
If step 7 false,then,
•print Average marks=%2lf
8. STOP
#FLOWCHART
#CODE
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main() {
float *p, sum = 0;
int i, n;
clrscr();
printf("Enter the number
of students: ");
scanf("%d", &n);
p=(float*)malloc(n*sizeof(fl
oat)); if(p==NULL)
{
printf("Memory allocation
failed");
exit(1);
}
for(i = 0; i < n; i++)
{
printf("Enter marks for %d student: ",i+1);
scanf("%f", p+i);
}
for(i = 0; i < n; i++)
{
sum=
*(p+i);

}
printf("\nAverage marks = %.2f\n",
sum/n); getch();

#OUTPUT

You might also like