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

C Lab

The document contains 28 questions and their solutions related to C programming concepts like printing, input/output, arithmetic operations, conditional statements, loops, functions and arrays. The questions cover basic programs to print text, take user input, perform calculations, conditional logic, looping constructs and using functions and arrays. The solutions provided utilize standard C syntax like header files, main function, printf, scanf, if-else, for/while loops, functions etc. to implement the required logic.

Uploaded by

Ekas Singh
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

C Lab

The document contains 28 questions and their solutions related to C programming concepts like printing, input/output, arithmetic operations, conditional statements, loops, functions and arrays. The questions cover basic programs to print text, take user input, perform calculations, conditional logic, looping constructs and using functions and arrays. The solutions provided utilize standard C syntax like header files, main function, printf, scanf, if-else, for/while loops, functions etc. to implement the required logic.

Uploaded by

Ekas Singh
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 41

Q. No.

TOPIC
1 Printing Hello World
2 Printing Address
3 Star Pattern Printing
4 Sum of Five numbers
5 Reading a Number and Writing Value
6 Reading Numbers of five subjects and Printing there sum
7 Swapping Two Numbers Using Third Variable
8 Swapping Two Numbers Without Using Third Variable
9 Printing ASCII value of a character
10 Printing character value of an integer
11 Area And Perimeter of a Circle
12 Cube of a Number
13 Average of 3 Numbers
14 Precision
15 Print Using Scientific Notation
16 Days to Month
17 Conversion of amount to Rupees and Paise
18 Largest of Three Numbers
19 Checking Odd or Even
20 Larger of Two Numbers using if statements
21 Larger of Three Numbers using if statements
22 Printing Natural numbers to n using while loop
23 Printing First n even numbers using while loop
24 Printing first n odd numbers using for loop
25 Sum of First n natural numbers using loop
26 Sum of First n even natural numbers using loop
27 Sum of First n odd natural numbers using loop
28 Multiplication Table of n given number using loop
29 Checking character, consonant or variable
30 Grading Students Using Switch
31 Menu driven Bitwise Program
32 Pattern Printing
33 Print Hello World Using Function
34 Square of a number using function
35 Factorial of a number using function
36 Fibonacci Series Using Function
37 Prime Number Using Function
38 Factorial of a Number Using Recursion
39 Fibonacci Series Using Function
40 Sum and Average of Array elements
41 Maximum element of an Array
42 Count Number of Negative and Positive elements of an Array
43 Sum of Odd and Even elements of an Array
44 Searching an Element in an Array using Function
45 Reversing Array using Function
46 Menu Driven Program for String Functions
Q1.WRITE A PROGRAM TO PRINT “HELLO WORLD”

#include <stdio.h>
int main()
{
printf("Hello World");
return 0;
}

Q2.WRITE A PROGRAM TO PRINT YOUR ADDRESS

#include <stdio.h>
int main()
{
printf("Enter House No: 14");
printf("\nEnter Lane: West Patel Nagar");
printf("\nEnter City: New Delhi");
printf("\nEnter Pincode: 110008");
return 0;
}

Q3.WRITE A PROGRAM TO PRINT PATTERN

#include <stdio.h>
int main()
{
int i,j=4,c;
for(i=0;i<=j;i++)
{
for(c=0;c<=i;c++)
{
printf("*");
}
printf("\n");
}
}

Q4.WRITE A PROGRAM TO PRINT SUM OF FIVE NUMBERS

#include <stdio.h>
int main()
{
int i,sum=0,j,value;
printf("How many numbers you want to add?: ");
scanf("%d", &j);
printf("Enter %d integers\n", j);
for(i=1;i<=j;i++)
{
scanf("%d", &value);
sum = sum + value;
}
printf("Sum of the integers = %d\n",sum);
return 0;
}

Q5.WRITE A PROGRAM TO READ A NUMBER AND PRINT ITS VALUE

#include <stdio.h>
int main()
{
int a;
printf("Enter a number\n");
scanf("%d",&a);
printf("The input is: %d",a);
}

Q6.WRITE A PROGRAM TO READ MARKS FOR FIVE SUBJECTS AND


PRINT THEIR SUM

#include <stdio.h>
int main()
{
int a,b,c,d,e,sum;
printf("English:\n");
scanf("%d",&a);
printf("Maths:\n");
scanf("%d",&b);
printf("Science:\n");
scanf("%d",&c);
printf("Computer Science:\n");
scanf("%d",&d);
printf("PE:\n");
scanf("%d",&e);
sum=a+b+c+d+e;
printf("Total marks: %d",sum);
}

Q7.WRITE A PROGRAM TO SWAP TWO NUMBERS AND PRINT ITS


VALUE USING THIRD VARIABLE

#include <stdio.h>
int main()
{
int a=6,b=9,c=0;
c=a;
a=b;
b=c;
printf("%d %d",a,b);
}

Q8.WRITE A PROGRAM TO SWAP TWO NUMBERS WITHOUT USING


THIRD VARIABLE

#include <stdio.h>
int main()
{
int a=6,b=9;

printf("Integers before swap: %d%d\n",a,b);


a=a+b;
b=a-b;
a=a-b;
printf("Integers after swap: %d%d",a,b);
return 0;
}

Q9.WRITE A PROGRAM TO FIND THE ASCII VALUE OF A CHARACTER

#include <stdio.h>
int main()
{
char c;
printf("Enter a character: ");
// Reads character input from the user
scanf("%c", &c);
// %d displays the integer value of a character
// %c displays the actual character
printf("ASCII value of %c = %d", c, c);
return 0;
}

Q10.WRITE A PROGRAM TO TAKE AN INTEGER AND PRINT ITS


CHARACTER

#include <stdio.h>
int main()
{
int a;
printf("Enter an integer\n");
scanf("%d", &a);
printf("The character is %c\n", a);
return 0;
}

Q11.WRITE A PROGRAM TO FIND THE AREA AND PERIMETER OF


THE CIRCLE

#include <stdio.h>
#define PI 3.14f
int main()
{
float r,a,p;
printf ("Enter the radius of circle: ");
scanf ("%f",&r);
a=PI*r*r;
p=2*PI*r;
printf("Area of circle: %f \nPerimeter of circle: %f\n",a,p);
return 0;
}

Q12.WRITE A PROGRAM TO FIND THE CUBE OF A NUMBER


int main()
{
int num,cube;
printf("Enter number \n");
scanf("%d",&num);
/* Cube is calculated. */
cube = num * num * num;
printf("Cube of a number is %d",cube);
return 0;
}

Q13.WRITE A PROGRAM TO FIND THE AVERAGE OF THREE


NUMBERS

int main()
{
float a,b,c,av=0;
printf("Enter any three numbers to find their average \n");
scanf("%f%f%f",&a,&b,&c);

av=(a+b+c)/3.0;
printf("\n Average of three numbers is \t %f",av);
return 0;
}

Q14.WRITE A PROGRAM TO USE PRECISION


#include <stdio.h>
int main()
{
float a;
printf("enter a decimal number :");
scanf("%f",&a);
printf("number after precision(2places):%0.2f",a);
return 0;
}

Q15.WRITE A PROGRAM TO PRINT USING SCIENTIFIC NOTATION

#include <stdio.h>
int main()
{
float value=123456.456f;
printf("value: %f (using %%f format specifier)\n",value);
printf("value: %e (using %%e format specifier)\n",value);
return 0;
}

Q16.WRITE A PROGRAM TO CONVERT A GIVEN NUMBER OF DAYS


INTO MONTHS AND DAYS
#include <stdio.h>
int main()
{
int num,nom,nod;
printf("Enter number of days:");
scanf("%d",&num);
nom=num/30;
nod=num%30;
printf("\nnumber of months: %d",nom);
printf("\nnumber of days: %d",nod);
return 0;
}

Q17.WRITE A PROGRAM TO CONVERT AMOUNT IN PAISA TO


RUPEES AND PAISA

int main()
{
int n,r,p;
printf("Enter a number: ");
scanf("%d",&n);
r=n/100;
p=n%100;
printf("\n rupee: %d",r);
printf("\n paisa: %d",p);
return 0;
}

Q18.WRITE A PROGRAM TO PRINT THE LARGEST OF THREE


NUMBERS WHICH ARE INPUT BY USER USING CONDITIONAL
STATEMENTS

#include<stdio.h>
int main()
{
int a,b,c,num;
printf("Enter 3 numbers:\n");
scanf("%d %d %d",&a,&b,&c);
num=(a>b&&a>c?a:b>c?b:c);
printf("\nThe biggest number is: %d",num);
return 0;
}
Q19.WRITE A PROGRAM TO CHECK WHETHER THE GIVEN NUMBER
IS ODD OR EVEN USING CONDITIONAL STATEMENTS

#include <stdio.h>
int main()
{
int n;
printf("Enter a number to check whether it is odd or even: ");
scanf("%d",&n);
n%2==0?printf("%d is even",n):printf("%d is odd",n);
return 0;
}

Q20.WRITE A PROGRAM TO PRINT THE LARGEST OF TWO


NUMBERS USING IF STATEMENTS

#include<stdio.h>
int main()
{
int a,b;
printf("Enter A:");
scanf("%d",&a);
printf("Enter B:");
scanf("%d",&b);
if(a>b)
printf("A is larger..");
else
printf("B is larger..");
return 0;
}
Q21.WRITE A PROGRAM TO PRINT THE LARGEST OF THREE
NUMBERS USING IF STATEMENTS

#include<stdio.h>
int main()
{
int a,b,c;
printf("Enter A:");
scanf("%d",&a);
printf("Enter B:");
scanf("%d",&b);
printf("Enter C:");
scanf("%d",&c);
if((a>b)&&(a>c))
printf("A is the largest..");
else if((b>a)&&(b>c))
printf("B is the largest..");
else
printf("C is the largest..");
return 0;
}

Q22.WRITE A PROGRAM TO PRINT N NATURAL NUMBERS WHERE N


IS INPUT BY THE USER USING WHILE LOOP
#include<stdio.h>
int main()
{
int i=1,n;
printf("Enter N:");
scanf("%d",&n);
while(i<=n)
{
printf("%d\n",i);
i+=1;
}
return 0;
}

Q23. WRITE A PROGRAM TO PRINT FIRST N EVEN NUMBER USING


WHILE LOOP

#include<stdio.h>
int main()
{
int i=1,n;
printf("Enter N:");
scanf("%d",&n);
while(i<=n)
{
if (i%2==0)
printf("%d\n",i);
i+=1;
}
return 0;
}

Q24. WRITE A PROGRAM TO PRINT FIRST N ODD NUMBERS USING


FOR LOOP

#include<stdio.h>
int main()
{
int i=1,n;
printf("Enter N:");
scanf("%d",&n);
for(;i<=n;i+=1)
{
if(i%2!=0)
printf("%d\n",i);
}
return 0;
}
Q25. WRITE A PROGRAM TO PRINT SUM OF FIRST N NATURAL
NUMBERS USING LOOP

#include<stdio.h>
int main()
{
int i=1,n,sum=0;
printf("Enter N:");
scanf("%d",&n);
for(;i<=n;i++)
sum+=i;
printf("Sum: %d",sum);
return 0;
}

Q26. WRITE A PROGRAM TO FIND AND SUM OF THE


FIRST N EVEN NATURAL NUMBERS USING LOOP

#include<stdio.h>
int main()
{
int i,n,sum=0;
printf("Enter N:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(i%2==0)
{
printf("%d\n",i);
sum+=i;
}
}
printf("Sum: %d",sum);
return 0;
}

Q27. WRITE A PROGRAM TO FIND AND SUM OF THE FIRST N ODD


NATURAL NUMBERS USING LOOP.

#include<stdio.h>
int main()
{
int i,n,sum=0;
printf("Enter N:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(i%2!=0)
{
printf("%d\n",i);
sum+=i;
}
}
printf("Sum: %d",sum);
return 0;
}

Q28. WRITE A PROGRAM TO PRINT THE MULTIPLICATION TABLE OF


N GIVEN NUMBER USING LOOP

#include<stdio.h>
int main()
{
int i,n;
printf("Enter number for multiplication table:");
scanf("%d",&n);
for(i=1;i<=10;i++)
printf("%d * %d = %d\n",n,i,n*i);
return 0;
}

Q29. WRITE A PROGRAM PRINT THE CHARACTER IS CONSONANT


OR VOWEL USING SWITCH
#include<stdio.h>
#include<ctype.h>
int main()
{
char c;
printf("Enter a character:");
scanf("%c",&c);
switch(tolower(c))
{
case 'a':
printf("Vowel");
break;
case 'e':
printf("Vowel");
break;
case 'i':
printf("Vowel");
break;
case 'o':
printf("Vowel");
break;
case 'u':
printf("Vowel");
break;
default:
printf("Constant");
}
return 0;
}

Q30. WRITE A PROGRAM FOR GRADING OF STUDENTS USING IF


#include<stdio.h>
int main()
{
int avg;
printf("Enter average: ");
scanf("%d",&avg);
if(avg<=100 && avg>=80)
printf("Grade=A");
else if(avg<80 && avg>=60)
printf("Grade=B");
else if(avg<60 && avg>=50)
printf("Grade=C");
else if(avg<50 && avg>=40)
printf("Grade=D");
else
printf("Grade=F");
return 0;
}

Q 31. Write a menu driven program that makes use of do-while and
switch case and print the following.
PS. -------------------------Main Menu--------------------------
Bitwise and
Bitwise or
Bitwise compliment
Bitwise left shift
Bitwise right shift
Exit

/*Menu driven Bitwise Program*/


#include <stdio.h>
main()
{
int a, b, c;
char cont;
printf("----------------Main Menu------------------\n");
printf("1 \tBitwise AND\n");
printf("2 \tBitwise OR\n");
printf("3 \tBitwise Compliment\n");
printf("4 \tBitwise Left Shift\n");
printf("5 \tBitwise Right Shift\n");
printf("6 \tExit\n");

start:printf("\nEnter a number from above codes: ");


scanf("%d", &c);

switch(c)
{
case 1: printf("Enter First Number: ");
scanf("%d", &a);
printf("Enter Second Number: ");
scanf("%d", &b);
printf("a & b = %d\n", a&b);

printf("Do you want to continue? <y/n>: ");


fflush(stdin);
scanf("%c", &cont);
if(cont=='Y'||cont=='y')
goto start;

case 2: printf("Enter First Number: ");


scanf("%d", &a);
printf("Enter Second Number: ");
scanf("%d", &b);
printf("a | b = %d\n", a|b);
printf("Do you want to continue? <y/n>: ");
fflush(stdin);
scanf("%c", &cont);
if(cont=='Y'||cont=='y')
goto start;

case 3: printf("Enter Number: ");


scanf("%d", &a);
printf("~a = %d\n", a=~a);

printf("Do you want to continue? <y/n>: ");


fflush(stdin);
scanf("%c", &cont);
if(cont=='Y'||cont=='y')
goto start;

case 4: printf("Enter Number: ");


scanf("%d", &a);
printf("Enter unit of shift: ");
scanf("%d", &b);
printf("a << b = %d\n", a<<b);

printf("Do you want to continue? <y/n>: ");


fflush(stdin);
scanf("%c", &cont);
if(cont=='Y'||cont=='y')
goto start;

case 5: printf("Enter Number: ");


scanf("%d", &a);
printf("Enter unit of shift: ");
scanf("%d", &b);
printf("a >> b = %d\n", a>>b);

printf("Do you want to continue? <y/n>: ");


fflush(stdin);
scanf("%c", &cont);
if(cont=='Y'||cont=='y')
goto start;
}
}

Q32. PRINT THE FOLLOWING PATTERNS


1.
#include<stdio.h>
int main()
{
int i,j;
for(i=0;i<4;i++)
{
for(j=0;j<4;j++)
{
printf("1");
}
printf("\n");
}
return 0;
}

2.
#include<stdio.h>
int main()
{
int i,j,x=1;
for(i=0;i<4;i++)
{
for(j=0;j<4;j++)
{
printf("%d\t",x);
x+=1;
}
printf("\n");
}
return 0;
}
3.
#include<stdio.h>
int main()
{
int i,j;
for(i=1;i<5;i++)
{
for(j=1;j<=i;j++)
{
printf("%d",j);
}
printf("\n");
}
return 0;
}

4.
#include<stdio.h>
int main()
{
int i,j;
for(i=1;i<5;i++)
{
for(j=1;j<=i;j++)
{
printf("%d",i);
}
printf("\n");
}
return 0;
}

4.
#include<stdio.h>
int main()
{
int i,j;
for(i=0;i<4;i++)
{
for(j=0;j<=i;j++)
{
printf("*");
}
printf("\n");
}
return 0;
}

5.
#include<stdio.h>
int main()
{
int i,j;
for(i=4;i>0;i--)
{
for(j=0;j<i;j++)
{
printf("*");
}
printf("\n");
}
return 0;
}

6.
#include<stdio.h>
int main()
{
int i,j,k;
for(i=3;i>=1;i--)
{
for(j=1;j<i;j++)
{
printf(" ");
}
for(k=3;k>=i;k--)
{
printf("*");
}
printf("\n");
}
return 0;
}
7.
#include<stdio.h>
int main()
{
int i,j,k;
for(i=4;i>=1;i--)
{
for(j=1;j<i;j++)
{
printf(" ");
}
for(k=4;k>=i;k--)
{
printf("*");
}
printf("\n");
}
return 0;
}

8.
#include<stdio.h>
int main()
{
int i,j;
for(i=0;i<4;i++)
{
for(j=0;j<=i;j++)
{
if((i+j)%2==0)
printf("1");
else
printf("0");
}
printf("\n");
}
return 0;
}

9.
#include<stdio.h>
int main()
{
int i,j;
char c='A';
for(i=0;i<4;i++)
{
for(j=0;j<=i;j++)
{
printf("%c",c);
}
c++;
printf("\n");
}
return 0;
}
10.
#include<stdio.h>
int main()
{
int i,j;
for(i='A';i<'E';i++)
{
for(j='A';j<=i;j++)
{
printf("%c",j);
}
printf("\n");
}
return 0;
}

Q33. WRITE A PROGRAM TO PRINT THE HELLO WORLD USING


FUNCTIONS
#include<stdio.h>
void print()
{
printf("HELLO");
}
main()
{
print();
return 0;
}
Q34. WRITE A PROGRAM TO PRINT THE SQUARE OF A NUMBER
USING FUNCTIONS

#include<stdio.h>
void square(int n)
{
printf("SQUARE OF %d: %d",n,n*n);
}
int main()
{
int x;
printf("ENTER A NUMBER: ");
scanf("%d",&x);
square(x);
return 0;
}

Q35. WRITE A PROGRAM TO PRINT FACTORIAL OF NUMBER USING


FUNCTIONS

#include<stdio.h>
void fact()
{
int i,fact=1,n;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
fact=fact*i;
}
printf("Factorial of %d is:%d",n,fact);
}
int main()
{
printf("Enter a Number:");
fact();
return 0;
}

Q36. WRITE A PROGRAM TO PRINT FIBONACCI SERIES USING


FUNCTIONS

#include<stdio.h>
void fibonacci(int n)
{
int a=0,b=1,c,i;
printf("Fibonacci Series:\n");
printf("0\n");
for(i=1;i<=n-1;i++)
{
c=a+b;
printf("%d\n",c);
a=b;
b=c;
}
}
int main()
{
int n;
printf("Enter a number:");
scanf("%d",&n);
fibonacci(n);
return 0;
}
Q37. WRITE A PROGRAM TO PRIME NUMBERS USING FUNCTIONS

#include<stdio.h>
void prime(int n)
{
int i,flag=0;
for(i=2;i<=n-1;i++)
{
if(n%i==0)
flag=1;
}
if(flag==1)
printf("COMPOSITE NUMBER");
else
printf("PRIME NUMBER");
}
int main()
{
int n;
printf("ENTER A NUMBER:");
scanf("%d",&n);
prime(n);
return 0;
}
Q38. WRITE A PROGRAM TO FIND FACTORIAL OF NUMBER USING
RECURSION

#include<stdio.h>
int fact(int n)
{
if(n>1)
return n*fact(n-1);
else
return 1;
}

int main()
{
int n;
printf("Enter a positive integer:");
scanf("%d",&n);
printf("Factorial of %d=%d",n,fact(n));
return 0;
}

Q39. WRITE A PROGRAM TO PRINT FIBONACCI SERIES TILL A GIVEN


NO. USING RECURSION

#include<stdio.h>
int fibonacci(int n)
{
if(n==0)
return 0;
else if(n==1)
return 1;
else
return(fibonacci(n-1)+fibonacci(n-2));
}
int main()
{
int n,i;
printf("\nEnter a number:");
scanf("%d",&n);
printf("Fibonacci Series");
for(i=0;i<=n-1;i++)
printf("\n%d",fibonacci(i));
return 0;
}

Q40. WRITE A C PROGRAM TO FIND SUM AND AVERAGE OF ALL


ARRAY ELEMENTS

#include<stdio.h>
int main()
{
int array[20],n,i,avg,sum=0;
printf("ENTER THE NUMBER OF ELEMENTS YOU WANT TO
ENTER:");
scanf("%d",&n);
printf("ENTER ARRAY ELEMENTS:\n");
for(i=0;i<=n-1;i++)
{
scanf("%d",&array[i]);
sum+=array[i];
}
avg=sum/n;
printf("SUM:%d",sum);
printf("\nAVERAGE:%d",avg);
return 0;
}

Q41. WRITE A C PROGRAM TO FIND MAXIMUM ELEMENT IN AN


ARRAY

#include<stdio.h>
int main()
{
int array[5],i,e;
printf("ENTER ARRAY ELEMENTS:\n");
for(i=0;i<=2;i++)
{
scanf("%d",&array[i]);
}
e=array[0];
for(i=0;i<=2;i++)
{
if(array[i]>e)
e=array[i];
}
printf("MAXIMUM ELEMENT:%d",e);
return 0;
}

Q42. WRITE A C PROGRAM TO COUNT TOTAL NUMBER OF


NEGATIVE ELEMENTS, POSITIVE ELEMENTS IN AN ARRAY

#include<stdio.h>
int main()
{
int array[5],i,ctrneg=0,ctrpos=0;
printf("ENTER ARRAY ELEMENTS:\n");
for(i=0;i<=4;i++)
{
scanf("%d",&array[i]);
if(array[i]>=0)
ctrpos++;
else
ctrneg++;
}
printf("COUNT OF POSITIVE ELEMENTS:%d",ctrpos);
printf("\nCOUNT OF NEGATIVE ELEMENTS:%d",ctrneg);
return 0;
}

Q43. WRITE A C PROGRAM TO FIND SUM OF EVEN AND ODD


ELEMENTS IN AN ARRAY SEPARATELY

#include<stdio.h>
int main()
{
int array[10],i,odd_sum=0,even_sum=0;
printf("ENTER ARRAY ELEMENTS:\n");
for(i=0;i<=5;i++)
{
scanf("%d",&array[i]);
if(array[i]%2==0)
even_sum+=array[i];
else
odd_sum+=array[i];
}
printf("SUM OF EVEN ELEMENTS:%d\n",even_sum);
printf("SUM OF ODD ELEMENTS:%d",odd_sum);
return 0;
}
Q44. WRITE A C PROGRAM TO SEARCH AN ELEMENT IN AN ARRAY
USING LINEAR SEARCH USING FUNCTIONS

#include<stdio.h>
int main()
{
int array[20],search,i;
printf("ENTER ARRAY ELEMENTS:\n");
for(i=0;i<=4;i++)
scanf("%d",&array[i]);
printf("ENTER THE NUMBER TO BE SEARCHED:\n");
scanf("%d",&search);
for(i=0;i<=4;i++)
{
if(array[i]==search)
{
printf("%d FOUND AT:%d\n",search,i+1);
}
}
return 0;
}
Q45. WRITE A C PROGRAM TO FIND REVERSE OF AN ARRAY USING
FUNCTIONS

#include<stdio.h>
void reverse(int arr[], int start, int end)
{
int temp;
while (start < end)
{
temp = arr[start];
arr[start] = arr[end];
arr[end] = temp;
start++;
end--;
}
}
void print(int arr[], int size)
{
int i;
for (i=0;i<size;i++)
printf("%d ",arr[i]);

printf("\n");
}
main()
{
int arr[] = {1, 2, 3, 4, 5, 6};
int n = sizeof(arr) / sizeof(arr[0]);
print(arr, n);
reverse(arr, 0, n-1);
printf("REVERSED ARRAY IS:\n");
print(arr, n);
return 0;
}

You might also like