Write a program that accepts an array of numbers and a
number, and return a string “Yes” if
the number is found in the array, “No” if the number is not
found in the array.

Answers were Sorted based on User's Feedback



Write a program that accepts an array of numbers and a number, and return a string “Yes” if th..

Answer / lince

Dim num() As Integer = {5, 3, 6, 7, 1}
Public Function Find(ByVal sNum As Integer) As String
Dim i As Integer = 0
For i = 0 To num.Count - 1
If (sNum = num(i)) Then
Return "Yes"
End If
Next
Return "No"
End Function

Is This Answer Correct ?    1 Yes 0 No

Write a program that accepts an array of numbers and a number, and return a string “Yes” if th..

Answer / surabhi

void main()
{
int num,i=0,f=0;
int n[]={20,30,40,50};
printf("\n enter no:");
scanf("%d",&num);
for(;i<4;)
{
if(num==n[i++])
{
printf("\n YES");
f=1;
break;
}
}
if(f==0)
printf("\n NO");
getch();
}

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More VB.NET Interview Questions

What is the diff between vb mdi form and .net mdi form?

0 Answers  


What are the difference between structure and class?

0 Answers  


what is difference between namespace and assembly?

0 Answers  


How is VB.Net different from VB6?

7 Answers   Ksb,


diff b/w windows and console application?

4 Answers  






how to connect crystal report with vb.net ?

2 Answers   Patni,


What is the use of internal keyword?

0 Answers  


Explain the services provided by common language infrastructure.

0 Answers  


What is the use of errorprovider control?

0 Answers  


What is the use of console application?

0 Answers  


Why Datareader is useful?

5 Answers  


how to create views in sql with syntax and example

5 Answers  


Categories