Write a function that accepts an array of integer values. The function should find the number which divides all the other numbers.
CODING:
#include<stdio.h>
#include<conio.h>
void search(int no,int a[10]);
void display(int no,int a[10]);
int i,i;
void main()
{
int num[10],n,i;
clrscr();
printf("\n HOW MANY NUMBER YOY WANT TO ENTER:");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\nENTER THE NUMBER=%d",i++);
scanf("%d",&num[i]);
}
printf("\n ARRAY ELEMENTS:");
display(n,num);
search(n,num);
getch();
}
void search(int no,int a[10])
{
int b,flag=0;
printf("\n ENTER NUMBER YOU WANT OT FOUND");
scanf("%d",&b);
for(i=0;i<no;i++)
{
if(a[i]==b)
{
flag=1;
break;
}
}
OUTPUT:
CODING:
#include<stdio.h>
#include<conio.h>
void search(int no,int a[10]);
void display(int no,int a[10]);
int i,i;
void main()
{
int num[10],n,i;
clrscr();
printf("\n HOW MANY NUMBER YOY WANT TO ENTER:");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\nENTER THE NUMBER=%d",i++);
scanf("%d",&num[i]);
}
printf("\n ARRAY ELEMENTS:");
display(n,num);
search(n,num);
getch();
}
void search(int no,int a[10])
{
int b,flag=0;
printf("\n ENTER NUMBER YOU WANT OT FOUND");
scanf("%d",&b);
for(i=0;i<no;i++)
{
if(a[i]==b)
{
flag=1;
break;
}
}
OUTPUT:
<<BACK |
Comments
Post a Comment