In this program, five values will be entered by user and different combinations of the numbers will be displayed. In this post, the same program is done using C Language
#include<stdio.h>
void main ()
{
int i,j,x;
int arr[5];
for(i=0;i< 5;i++)
{
printf("Enter value:");
scanf("%d",&arr[i]);
}
printf("The original valoues are \n");
for(i=0;i< 5;i++)
printf(" 5d "+arr[i]);
printf("\nThe Combination are as follows \n");
for(i=0;i < 5;i++)
{
x=i;
for(j=0;j< 5;j++)
{
printf("%d "+arr[x]);
x++;
if(x> 4)
x=0;
}
printf("\n");
}
getch();
}
#include<stdio.h>
void main ()
{
int i,j,x;
int arr[5];
for(i=0;i< 5;i++)
{
printf("Enter value:");
scanf("%d",&arr[i]);
}
printf("The original valoues are \n");
for(i=0;i< 5;i++)
printf(" 5d "+arr[i]);
printf("\nThe Combination are as follows \n");
for(i=0;i < 5;i++)
{
x=i;
for(j=0;j< 5;j++)
{
printf("%d "+arr[x]);
x++;
if(x> 4)
x=0;
}
printf("\n");
}
getch();
}
No comments:
Post a Comment