Need an answer ASAP please! This is in C language. You don\'t need to write the
ID: 3827781 • Letter: N
Question
Need an answer ASAP please! This is in C language. You don't need to write the pseudocode, just the program.
Write pseudocode and translate it to C-program for the following problem. Ask users to input a series of integers which are in increasing order (i.e., an integer is NOT smaller than the one immediately before it). The input will end with the number 0. Assume users will never input more than 10 integers before input 0. After users input all the numbers, ask the user input another number m. Finally print to screen if the number m is in the series. Here is an example ofan execution ofyour program: (the underlined are user inputs) Input a series of integers (ended with 0) 1 3 15 200 Input a number to find from the series 9 The number 9 is not in the series you gave.Explanation / Answer
C-program
#include <stdio.h>
int main()
{
printf("input a series of integer ended with 0 ");
int testInteger,c=1,i=0,j=0,input,result=0;
int arr[20];
while(c!=0){
scanf("%d",&testInteger);
c=testInteger;
arr[i++]=testInteger;
}
printf("Input a series of integer (ended with 0):");
for(j=0;j<i;j++)
printf("%d ",arr[j]);
printf("Input a number to find from series:");
scanf("%d",&input);
for(j=0;j<i;j++){
if(input==arr[j]){
result=1;
break;
}
}
if(result==1){
printf("The number%d",input);
printf("is in series you gave");
}
else{
printf("The number%d",input);
printf("is not in series you gave");
}
}
Pseudeo code
Initialize c=0
print input a series of integer from user
while c not equal to 1
take input from user
until 0 is taken from keyboard
assign value to arr
for loop j=0 to j<i
if input equal to arr The number is in series you gave"
print "The number is in series you gave"
else
The number is not in series you gave"
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.