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

Why is c called a structured programming language?

1210


Can a variable be both static and volatile in c?

973


How can I delete a file?

1013


Why doesnt the call scanf work?

1137


Explain how can you restore a redirected standard stream?

1029


What is 'bus error'?

1085


What is the benefit of using const for declaring constants?

987


Do you have any idea how to compare array with pointer in c?

986


Are there namespaces in c?

1049


Why can’t constant values be used to define an array’s initial size?

1321


What is the use of a semicolon (;) at the end of every program statement?

1410


What is the use of header files?

1054


What the different types of arrays in c?

1019


Can we declare variables anywhere in c?

946


Can you write the algorithm for Queue?

2024