Write a C function to search a number in the given list of
numbers. donot use printf and scanf
Answer Posted / vignesh1988i
very sorry yaar/.... i forgettenly used printf statements in
my before posts.......... i think this can be the logic...
if am not wrong..............
#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)
{
char q[]="number is found";
puts(q);
}
else
{
char w[]="number not found";
puts(w);
}
getch();
}
| Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
in linking some of os executables are linking name some of them
What is c language & why it is used?
What are valid operations on pointers?
What is a stream in c programming?
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
What Is The Difference Between Null And Void Pointer?
Declare the structure which contains the following members and write in C list of all students who score more than 75 marks. Roll No, Name, Father Name, Age, City, Marks.
How can I do graphics in c?
my project name is adulteration of chille powder.how can i explain it to the hr when he asks me about the project?
What are the types of data files?
Write a program in "C" to calculate the root of a quadratic equation ax^2+bx+c=0, where the value of a,b & c are known.
What is the behavioral difference when include header file in double quotes (“”) and angular braces (<>)?
Which node is more powerful and can handle local information processing or graphics processing?
What is volatile, register definition in C
What does it mean when the linker says that _end is undefined?