51 Write a program to find factorial of a number N
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n,i,fact=1;
printf("enter the value for n:");
scanf("%d",&n);
for (i=1;i<=n;i++)
{
fact=fact*i;
}
printf("factorial of %d is %d\n",n,fact);
}
OUTPUT:
enter the value for n:4
factorial of 5 is 24
52 Write a program to generate N Fibonacci series
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int first=-1,second=1,i,third,n;
printf("Enter the number of terms:");
scanf("%d",&n);
for(i=-1;i<=n;i++)
{
third=first+second;
printf("%d\n",third);
first=second;
second=third;
}
}
OUTPUT:
Enter the number of terms:6
0
1
1
2
3
5
8
13
53. Write a program to generate prime numbers within a range N
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,i,n,c,count=0;
printf("Enter the range:");
scanf("%d",&n);
for(a=1;a<=n;a++)
{
for(i=1;i<=n;i++)
{
c=a%i;
if(c==0)
{
count=count+1;
}
}
if (count==2)
{
printf("%d\n",a);
}
count=0;
}
}
OUTPUT:
Enter the range:7
2
3
5
7
54. Write a program to check a number is composite or prime number.
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n,i,c,count=0;
printf("Enter the number n:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
c=n%i;
if(c==0)
count=count+1;
}
if(count>2)
{
printf("The given number is composite number");
}
else if(n==0)
{
printf("The given number is neither prime nor composite");
}
else if(n==1)
{
printf("The given number is neither prime nor composite");
}
else
{
printf("The given number is prime number");
}
}
OUTPUT:
Enter the number n:7
The given number is prime number
55. Write a program to check a number is Armstrong number or not
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int num,originalnum,rem,result=0;
printf("Enter the three digit number:");
scanf("%d",&num);
originalnum=num;
while (originalnum!=0)
{
rem=originalnum%10;
result=result+(rem*rem*rem);
originalnum=originalnum/10;
}
if (num==result)
{
printf("%d is Armstrong Number",num);
}
else
{
printf("%d is Not Armstrong Number",num);
}
}
OUTPUT:
Enter the three digit number:153
153 is Armstrong Number
56. Write a C Program check whether a given number is perfect number or not.
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n,div,i,result=0;
printf("Enter the number:");
scanf("%d",&n);
for(i=1;i<n;i++);
{
div=n%i;
if(div==0)
{
result=result+div;
}
}
if (result==n)
{
printf("%d is perfect number",n);
}
else
{
printf("%d is not perfect number",n);
}
}
OUTPUT:
Enter the number:6
6 is perfect number
57. Write a program to accept a 5 digit number from user and perform Sum of 5 digits
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n,rem,result=0;
printf("Enter any 5 digit number:");
scanf("%d",&n);
while (n>0)
{
rem=n%10;
result=result+rem;
n=n/10;
}
printf("Sum of the given 5 digit number is:%d",result);
}
OUTPUT:
Enter any 5 digit number:11111
Sum of the given 5 digit number is:5
58. Write a program to Reverse a Number
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n,rem,reverse=0;
printf("Enter the number:");
scanf("%d",&n);
while (n!=0)
{
rem=n%10;
reverse=reverse*10+rem;
n=n/10;
}
printf("Reversed number is:%d",reverse);
}
OUTPUT:
Enter the number:598
Reversed number is:895
59. Square root of a number
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a;
float s;
printf("Enter the number:");
scanf("%d",&a);
s=sqrt(a);
printf("Square root of the given number:%f",s);
}
OUTPUT:
Enter the number:4
Square root of the given number:2.000000
60. Count the number of digits in a number
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,c,count=0;
printf("Enter the number:");
scanf("%d",&a);
b=a;
while(b>0)
{
c=a%10;
b=b/10;
count++;
}
printf("No of digits are %d",count);
}
OUTPUT:
Enter the number:9843
No of digits are 4
61. Write a program to convert binary number to decimal
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int rem,num,dec=0,base=1;
printf("Enter the binary number:");
scanf("%d",&num);
while(num>0)
{
rem=num%10;
dec=dec+rem*base;
num=num/10;
base=base*2;
}
printf("Converted decimal value is:%d",dec);
}
OUTPUT:
Enter the binary number:0010
Converted decimal value is:2
62. Write a program to convert decimal number to binary
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int num,dec,rem,base=1,i,binno=0;
printf("Enter the decimal number:");
scanf("%d",&num);
for (i=0;i<=dec;i++)
{
rem=num%2;
num=num/2;
binno=binno+rem*base;
base=base*10;
}
printf("The binary num:%d",binno);
}
OUTPUT:
Enter the decimal number:2
The binary num:10
63. Write a program to find the roots of a quadratic equation using if-else
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
float a,b,c,r1,r2,det;
printf("Enter the coefficients a,b,c:");
scanf("%f %f %f",&a,&b,&c);
det=b*b-(4*a*c);
if (det>0)
{
r1=(-b+sqrt(det))/2*a;
r2=(-b-sqrt(det))/2*a;
printf("Roots are real");
printf("value r1:%f and value of r2:%f",r1,r2);
}
else if (det==0)
{
printf("Roots are equal");
printf("\n value of r1:%f and value of r2:%f");
}
else
{
printf("Roots are not equal");
}
}
OUTPUT:
Enter the coefficients a,b,c:1 2 3
Roots are not equal
64. Matrix addition
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a[2][2],b[2][2],c[2][2],i,j;
printf("Enter the a matrix values:");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("Enter the b matrix values:");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&b[i][j]);
}
}
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
c[i][j]=a[i][j]+b[i][j];
}
}
printf(“The addition of two matrix is:”);
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("%d\t",c[i][j]);
}
printf(“\n”);
}
}
OUTPUT:
Enter the a matrix values:
11
33
Enter the b matrix values:
44
22
The addition of a and b matrix is :
55
5 5
65. Matrix subtraction
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a[2][2],b[2][2],c[2][2],i,j;
printf("Enter the a matrix values:");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("Enter the b matrix values:");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&b[i][j]);
}
}
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
c[i][j]=a[i][j]-b[i][j];
}
}
Printf(“The subtraction of the two matrices is “);
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("%d\t",c[i][j]);
}
printf(“\n”);
}
}
OUTPUT:
Enter the a matrix values:
78
54
Enter the b matrix values:
62
43
The subtraction of two matrices is:
1 6
1 1
66. Matrix multiplication
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a[2][2],b[2][2],c[2][2],i,j,k;
printf("Enter the a matrix values:");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("Enter the b matrix values:");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&b[i][j]);
}
}
printf(“The multiplication of the two matrices is”);
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
c[i][j]=0;
for(k=0;k<2;k++)
{
c[i][j]=c[i][j]+a[i][k]*b[k][j];
}
printf("%d\t",c[i][j]);
}
OUTPUT:
Enter the a matrix values:
12
34
Enter the b matrix values:
12
34
The multiplication of the two matrices is :
7 10
15 22
67. Bubble sort
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a[5],i,j,n,temp;
printf("Enter the value for n:");
scanf("%d",&n);
printf("Enter the array values:");
for (i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
for (j=0;j<n;j++)
{
if(a[j]>a[j+1])
{
temp=a[j+1];
a[j+1]=a[j];
a[j]=temp;
}
}
}
printf("The sorted array is:");
for (i=0;i<n;i++)
{
printf("%d\t",a[i]);
}
}
OUTPUT:
Enter the value for n:5
Enter the array values:19 11 45 63 21
The sorted array is:11 19 21 45 63
68. Insertion sort
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a[5],i,j,n,temp;
printf("Enter the value for n:");
scanf("%d",&n);
printf("Enter the array values:");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for (i=1;i<n;i++)
{
j=j-1;
temp=a[i];
while (j>=0&&a[j]>temp)
{
a[j+1]=a[j];
j--;
}
a[j+1]=temp;
}
printf("The sorted array is:");
for(i=0;i<n;i++)
{
printf("%d\t",a[i]);
}
}
OUTPUT:
Enter the value for n:5
Enter the array values:50 10 30 40 20
The sorted array is:50 10 30 40 20
69. To input N numbers from the user and search an element -Linear Search
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a[10],i,size,key,find=0;
printf("Enter the size:");
scanf("%d",&size);
printf("Enter the values of array a:");
for(i=0;i<5;i++)
{
scanf("%d",&a[i]);
}
printf("Enter the key value:");
scanf("%d",&key);
for (i=0;i<5;i++)
{
if(a[i]==key)
find=1;
}
if (find==1)
printf("Key value found");
else
printf("Key value not found");
}
OUTPUT:
Enter the size:5
Enter the values of array a:90 21 54 67 78
Enter the key value:10
Key value not found
70. HCF and LCM of two numbers
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int hcf,lcm,a,b,c,n1,n2;
printf("Enter any two numbers:");
scanf("%d %d",&n1,&n2);
a=n1;
b=n2;
while(b>0)
{
c=b;
b=a%b;
a=c;
}
printf("HCF is:%d\n",a);
lcm=(n1*n2)/a;
printf("LCM is:%d",lcm);
}
OUTPUT:
Enter any two numbers:15 2
HCF is:1
LCM is:30
71. To input 10 numbers from the user and print the largest number
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a[10],i,max;
printf("Enter the value for array a:");
for (i=0;i<10;i++)
{
scanf("%d",&a[i]);
}
max=a[0];
for (i=1;i<10;i++)
{
if(a[i]>max)
max=a[i];
}
printf("Largest element is:%d",max);
}
OUTPUT:
Enter the value for array a:98 23 45 67 99 78 64 23 45 76
Largest element is:98
72. To input 10 numbers from the user and print the smallest number
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a[10],i,min;
printf("Enter the value for array a:");
for (i=0;i<10;i++)
{
scanf("%d",&a[i]);
}
min=a[0];
for (i=1;i<10;i++)
{
if(a[i]<min)
min=a[i];
}
printf("Smallest element is:%d",min);
}
OUTPUT:
Enter the value for array a:12 29 35 49 58 60 78 87 93 96
Smallest element is:12
73. To get 10 numbers from the user and print the odd and even numbers
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a[10],n,i;
printf("Enter the value for n:");
scanf("%d",&n);
printf("Enter the array elements:");
for (i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
printf("Even numbers in the array:");
for(i=0;i<n;i++)
{
if (a[i]%2==0)
printf("%d\t",a[i]);
}
printf("\nOdd numbers in the array:");
for (i=0;i<n;i++)
{
if (a[i]%2!=0)
printf("%d\t",a[i]);
}
}
OUTPUT:
Enter the value for n:10
Enter the array elements:1 2 3 4 5 6 7 8 9 10
Even numbers in the array:2 4 6 8 10
Odd numbers in the array:1 3 5 7 9
74. Write a program in C to copy the elements of one array into another array
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i,n,a[20],b[20];
printf("Enter the value for n:");
scanf("%d",&n);
printf("Enter the array elements:");
for (i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for (i=0;i<n;i++)
{
b[i]=a[i];
}
printf("Elements of first array:");
for (i=0;i<n;i++)
{
printf("%d\t",a[i]);
}
printf("\nElements of second array:");
for (i=0;i<n;i++)
{
printf("%d\t",b[i]);
}
}
OUTPUT:
Enter the value for n:5
Enter the array elements:23 45 69 89 23
Elements of first array: 23 45 69 89 23
Elements of second array: 23 45 69 89 23
75. Write a program in C to merge two arrays of same size
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a[10],b[10],n1,n2,i,k,merge[20];
printf("Enter the value for n1:");
scanf("%d",&n1);
printf("Enter the array1 elements:");
for (i=0;i<n1;i++)
{
scanf("%d",&a[i]);
merge[i]=a[i];
}
k=i;
printf("\nEnter the value for n2:");
scanf("%d",&n2);
printf("Enter array 2 elements:");
for (i=0;i<n2;i++)
{
scanf("%d",&b[i]);
merge[k]=b[i];
k++;
}
printf("The merged array:");
for (i=0;i<k;i++)
{
printf("%d\t",merge[i]);
}
}
OUTPUT:
Enter the value for n1:5
Enter the array1 elements:11 12 13 14 15
Enter the value for n2:5
Enter array 2 elements:16 17 18 19 20
The merged array:11 12 13 14 15 16 17 18 19
20
76. To input N numbers from the user and print the sum of all elements in array
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a[10],n,i,sum=0;
printf("Enter the value for n:");
scanf("%d",&n);
printf("Enter the array elements:");
for (i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for (i=0;i<n;i++)
{
sum=sum+a[i];
}
printf("Sum of elements in the array:%d",sum);
}
OUTPUT:
Enter the value for n:5
Enter the array elements:11 9 20 50 10
Sum of elements in the array:100
77. Program to find transpose of a matrix
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a[10][10],i,j,n,m;
printf("Enter the no of rows and columns:");
scanf("%d %d",&n,&m);
printf("Enter the matrix:");
for(i=0;i<n;i++)
{
for (j=0;j<m;j++)
{
scanf("%d",&a[i][j]);
}
}
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
printf("%d\t",a[j][i]);
}
printf("\n");
}
OUTPUT:
Enter the no of rows and columns:2 2
Enter the matrix:
12
34
1 3
2 4
78. Selection sort
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a[50],n,i,j,temp;
printf("Enter the value of n:");
scanf("%d",&n);
printf("Enter the values:");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(a[i]>a[j])
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
for(i=0;i<n;i++)
{
printf("%d\t",a[i]);
}
}
OUTPUT:
Enter the value of n:4
Enter the values:56 78 34 89
34 56 78 89
79 To input a 2 dimensional array and print it in the matrix format
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int m,n,a[10][10],i,j;
printf("Enter the no of rows and columns:");
scanf("%d %d",&m,&n);
printf("Enter the values:");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&a[i][j]);
printf("%d\t",a[i][j]);
}
printf("\n");
}
}
OUTPUT:
Enter the no of rows and columns:3 3
Enter the values:11 12 13 14 15 16 17 18 19
11 12 13
14 15 16
17 18 19
80. To find the length of a String without string function
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
char str[20];
int i,count=0;
printf("Enter a string:");
scanf("%s",str);
for(i=0;str[i]!='\0';i++)
{
count++;
}
printf("Length of the string:%d",count);
}
OUTPUT:
Enter a string:abi
Length of the string:3
81. Strlen, strcpy, strcat, strrev
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
char name[10]="HARLEY";
int num;
num=strlen(name);
printf("No of characters:%d",num);
strcpy(name,"HARLEY");
printf("\nCopied name:%s",name);
strcat(name,"DAVIDSON");
printf("\nCombined name:%s",name);
strrev(name);
printf("\nReversed name:%s",name);
}
OUTPUT:
No of characters:5
Copied name:HARLEYDAVIDSON
Combined name:HARLEYDAVIDSON
Reversed name:NOSDIVADEYLRAH
82 To concatenate two strings without string function
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
char str1[20],str2[20];
int length,j;
printf("Enter the first string:");
scanf("%s",str1);
printf("Enter the second string:");
scanf("%s",str2);
length = 0;
while (str1[length] != '\0')
{
length++;
}
for (j=0;str2[j] != '\0';j++,length++)
{
str1[length] = str2[j];
}
str1[length] ='\0';
printf("After concatenation: ");
puts(str1);
}
OUTPUT:
Enter the first string:HELLO
Enter the second string:WORLD
After concatenation: HELLOWORLD
83. Write a C program to find the ASCII value of a character or a string.
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
char ch;
printf("Enter a character:");
scanf("%s",&ch);
printf("The ascii value is :%d",ch);
OUTPUT:
Enter a character:A
The ascii value is :63
84 To reverse a string without string function
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
char string[20],temp;
int i,length;
printf("Enter a String:");
scanf("%s",string);
length=strlen(string)-1;
for(i=0;i<strlen(string)/2;i++){
temp=string[i];
string[i]=string[length];
string[length--]=temp;
}
printf("Reverse string :%s",string);
}
OUTPUT:
Enter a String:HELLO
Reverse string :OLLEH
85 Program to sort N names
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i,j,n;
char str[100][100],s[100];
printf("Enter number of names:");
scanf("%d",&n);
printf("Enter names in any order:");
for(i=0;i<n;i++)
{
scanf("%s",str[i]);
}
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(strcmp(str[i],str[j])>0)
{
strcpy(s,str[i]);
strcpy(str[i],str[j]);
strcpy(str[j],s);
}
}
}
printf("The sorted order of names are:\n");
for(i=0;i<n;i++)
{
printf("%s\n",str[i]);
}
}
OUTPUT:
Enter number of names:4
Enter names in any order:john abi ram lily
The sorted order of names are:
abi
john
lily
ram
86 Program to count number of vowels in a string
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int c = 0,count = 0;
char s[100];
printf("Input a string\n");
gets(s);
while (s[c] != '\0')
{
if (s[c] =='a'||s[c]=='A'||s[c]=='e'||s[c]=='E'||s[c]=='i'|| s[c] == 'I' || s[c] =='o' ||
s[c]=='O' || s[c] == 'u' || s[c] == 'U')
count++;
c++;
}
printf("Number of vowels in the string: %d", count);
}
OUTPUT:
Input a string
ABI
Number of vowels in the string: 1
87 Program to check a string is palindrome or not
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
char string1[20];
int i, length;
int flag = 0;
printf("Enter 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==1)
{
printf("String is not a palindrome");
}
else
{
printf("String is a palindrome");
}
}
OUTPUT:
Enter a string:racecar
String is a palindrome
88. Program to remove all characters in a string except alphabet
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char line[150];
printf("Enter a string:");
fgets(line,sizeof(line),stdin);
for (int i=0,j;line[i]!='\0';i++)
{
while (!(line[i] >= 'a' && line[i] <= 'z') && !(line[i] >= 'A' && line[i] <= 'Z') && !(line[i]
== '\0'))
{
for (j = i; line[j] != '\0'; ++j)
{
line[j] = line[j + 1];
}
line[j] = '\0';
}
}
printf("Output String: ");
puts(line);
}
OUTPUT:
Enter a string:abinaya@shri
Output String: abinayashri
89. To input N numbers from the user and search an element -Binary Search
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i,low,high,mid,n,search,array[100];
printf("Enter number of elements:");
scanf("%d",&n);
printf("Enter %d integers:",n);
for(i=0;i<n;i++)
scanf("%d",&array[i]);
printf("Enter value to find:");
scanf("%d",&search);
low=0;
high=n-1;
mid=(low+high)/2;
while (low <= high)
{
if(array[mid]<search)
{
low = mid + 1;
}
else if (array[mid]==search)
{
printf("%d FOUND",search,mid+1);
break;
}
else
{
high=mid-1;
mid=(low+high)/2;
}
}
if(low > high)
printf("%d NOT FOUND",search);
}
OUTPUT:
Enter number of elements:4
Enter 4 integers:19 89 56 33
Enter value to find:33
33 FOUND
90. Write a C program to display the following patterns
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i, j, k, N;
printf("Enter N: ");
scanf("%d", &N);
k = 1;
for(i=1; i<=N; i++)
{
for(j=1; j<=i; j++, k++)
{
printf("%3d", k);
}
printf("\n");
}
}
OUTPUT:
Enter N: 4
1
2 3
4 5 6
7 8 9 10
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i,j,k;
k=1;
for(i=1;i<=5;i+=2)
{
for(j=5;j>=1;j--)
{
if(j>i)
printf(" ");
else
printf("%d ",k++);
}
printf("\n");
}
}
OUTPUT:
1
234
56789