Tuesday, July 14, 2009

C++programme to accept 10 elements into an array then find out a particular number?

it is a c++ programme about arrays

C++programme to accept 10 elements into an array then find out a particular number?
#include%26lt;iostream.h%26gt;


#include%26lt;conio.h%26gt;





void main()


{


int a[10],ele,i;


clrscr();


printf("\n");


for(i=0;i%26lt;10;i++)


{


printf("Enter a[%d] - ",i);


scanf("%d",%26amp;a[i]);


}


printf("Enter number to be searched - ");


scanf("%d",%26amp;ele);


for(i=0;i%26lt;10;i++)


{


if(a[i]==ele)


break;


}


if(i%26lt;10)


printf("Number is present");


if(i==10)


printf("Element not present");


getch();


}





It will work for you...

narcissus

No comments:

Post a Comment