Question

C programming

Write a C program to take N numbers of integer in an array. Then take a number M from user and search it in the array. If number M is found in the array, then print “Number ta paisi!!”, and if not found then print “Pailam na vi number ta!!”.


Sample Input:                                         Sample Output:

Enter value of N: 5

Enter numbers in array: 7 4 5 2 9           Number ta paisi!!

Enter value of M:


4 0
Add a comment Improve this question Transcribed image text
Answer #1

#include


int main()

{

    // decalre variables

    int n,m,arr[100];

    // input value n

    printf("Enter value of N: ");

    scanf("%d",&n);

    // iterate loop and take the value of arr

    printf("Enter numbers in array: ");

    for(int i=0;i<n;i++)

    {

        scanf("%d",&arr[i]);

    }

    // input m

    printf("Enter value of M: ");

    scanf("%d",&m);

    // iterate and check the value present in array 

    for(int j=0;j<n;j++)

    {

        if(arr[j]==m)

        {

            printf("Number ta paisi!!");

            return 0;

        }

    }

    // if not then

    printf("Pailam na vi number ta!!");

    return 0;

}


answered by: Allen

> Thank you so much

Umar Ali Ashraf Wed, Jan 12, 2022 1:12 AM

Add a comment
Know the answer?
Add Answer to:
C programming
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • (C programing, Not C++) Write a program in C that asks the user to input 10...

    (C programing, Not C++) Write a program in C that asks the user to input 10 numbers. Store these numbers in an array. Then ask the user to input a single number. Your program should execute a linear search on the array, trying to find that number. If the number exists in the array, have the program print out which position/element the number was found at. If the target number is not in the array, have the program print out...

  • use c++ language, keep it simple i am using code block Exercise#2: Arrays with Random Numbers...

    use c++ language, keep it simple i am using code block Exercise#2: Arrays with Random Numbers Write a program that generates n random numbers as follows: Asks the user to input a positive integer n Asks the user to input the maximum value (say m) for the integers to be generated. Write a program that generates the n numbers in the range 0 to m. The program stores the generated numbers in an array A[ Asks the user to enter...

  • In C++ Please work on the following short programming assignments and upload your solutions on a...

    In C++ Please work on the following short programming assignments and upload your solutions on a single .txt file. 1. Write a function to take two integers and return the maximum number. Then, in the main function, ask the user to enter 2 numbers and output the maximum using the function. 2. Write a program to input 5 integers and store them in an array. Then, show the array in the output. 3. Write a program to input 5 numbers...

  • please solve it before 11:15 today Subject :C++ programming - Lab_9_Sec 51.pdf 1411113: Programming for Engineers...

    please solve it before 11:15 today Subject :C++ programming - Lab_9_Sec 51.pdf 1411113: Programming for Engineers Fall 2017/2018 LAB #9 Name: ID: Date Section Objectives: After completing this lab, you will be able to .Analyze a problem. .Implement the solution in C++ . Practice arrays and strings. Lab Exc. Mark Score Correct input/output Computational correctness Correct input/output Computational correctness Exercise#1: Number of occurrences in an array Write a program that fills an array with 10 random numbers between 0 and...

  • Write in C++ program Larger than n In a program, write a function that accepts three...

    Write in C++ program Larger than n In a program, write a function that accepts three arguments: an array, the size of the array, and a number n. Assume the array contains integers. The function should display all of the numbers in the array that are greater than the number n. Input from the keyboard: The filename and path of a list of integer numbers.                                           The number n to test the file numbers. Output to the console: The...

  • Programming language C Please go through this carefully. Needs function void add(int *a1, int n, int...

    Programming language C Please go through this carefully. Needs function void add(int *a1, int n, int *a2) Write a program addition.c that reads in an array (a1) of numbers, and creates a new array (a2) of numbers such that the first and last numbers of a1 are added and stored as the first number, the second and second-to-last numbers are added and stored as the second number, and so on. You need to check for even and odd length of...

  • c++. please show screenshots of output This project will continue to familiarize the student with using...

    c++. please show screenshots of output This project will continue to familiarize the student with using arrays. Store all the function proto-types in project11_funch and store all the functions in project11_func.cpp. Make sure you have proper header comments in each.h,.cpp file. When you run your program, your sample output should show your name. Your report should include the following: 1) project11_func.h 2) project11_func.cpp 3) project11.cpp 4) sample output Write the following functions: a) void fill_array_with_random_nums(int array(), int N): Fill array...

  • Use C programming Make sure everything works well only upload Write a program that takes an...

    Use C programming Make sure everything works well only upload Write a program that takes an integer from standard input and prints all prime numbers that are smaller than it to standard output. Recall that a prime number is a natural number greater than 1 whose only positive divisors are 1 and itself. At the start of the program, prompt the user to input a number by printing "Input a number greater than 2:\n". If the user's input is less...

  • LANGUAGE = C i. Write a program that takes int numbers from user until user gives...

    LANGUAGE = C i. Write a program that takes int numbers from user until user gives a sentinel value (loop terminating condition). Sort the numbers in ascending order using Insertion sort method. Sorting part should be done in different function named insertionSort(). Your code should count the number of swaps required to sort the numbers. Print the sorted list and total number of swaps that was required to sort those numbers. (4 marks) ii. In this part take another number...

  • use C++ programming language and follow the instruction carefully. thanks! Inputs: . [integer] values (10 times)...

    use C++ programming language and follow the instruction carefully. thanks! Inputs: . [integer] values (10 times) Outputs: • [integer) highest value . [integer] lowest value Description: Write a program that lets the user enter 10 values. These values should be stored in an array. Your program will then find the highest and lowest values in the array. Your program will display the list of number as a comma separated list, and print which values is the highest and lowest Do...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT