Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Write a C function to search a number in the given list of
numbers. donot use printf and scanf

Answer Posted / vignesh1988i

#include<stdio.h>
#include<conio.h>
void main()
{
char a[]="enter the no. of terms tou are going to enter :";
char a1[100];
char n;
puts(a);
int flag=0;
n=getchar();
int n1;
n1=(int)n /* type casting*/
for(int i=0;i<n1;i++)
{
a[i]=getchar();
}
char a3[]="enter the number do you want to find :";
puts(a3);
char s;
s=getchar();
int b=(int)s;
for(i=0;i<n1;i++)
{
if(b==(int)a[i])
flag=1;
}
if(flag==1)
printf("number is found");
else
printf("not found");
getch();
}
this was the logic suddenly striked me.......................

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a program flowchart and explain how does it help in writing a program?

1266


Explain what are run-time errors?

1058


What is a program flowchart and how does it help in writing a program?

1108


Explain threaded binary trees?

1132


praagnovation

2240


What is this infamous null pointer, anyway?

1006


What is d'n in c?

1088


which is an algorithm for sorting in a growing Lexicographic order

1763


How do I get a null pointer in my programs?

1079


Is flag a keyword in c?

1126


How can I avoid the abort, retry, fail messages?

1106


What is assert and when would I use it?

975


How do I swap bytes?

1043


can we change the default calling convention in c if yes than how.........?

2495


Explain what is a static function?

1077