C Answers

Questions answered by Experts: 1 680

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

Given an array arr[] sorted in ascending order of size N and an integer K. Check if K is present in the array or not. (Use Binary Search)

Input: N = 5 K = 6 arr[] = {1,2,3,4,6}

Output: 1

Explanation: Since, 6 is present in the array at index 4 (0-based indexing),

Output is 1 


Write a program that reads in a sequence of characters and prints them in reverse order (Use a stack).


Given an array array[], its starting position l and its ending position r. Sort the array using Bucket Sort algorithm.

Input: N = 10

array[] = {10 9 7 8 6 2 4 3 5 1}

Output: 1 2 3 4 5 6 7 8 9 10 


Counting Num


To give you more of a challenge with a number's digits, let's try counting how many of a certain digit is present on a given number.


Let's start coding!


Instructions:

  1. Input two integer values. The first one shall accept any integer from 0-9 and the other one shall take a non-zero positive integer.
  2. Using a while loop, count how many of the first integer (0-9) is present in the digits of the second inputted integer and print the result (see sample input and output for example).
  3. Tip #1: You have to use your knowledge from the previous problems in looping through the digits of a number: % 10 to get the rightmost digit, while / 10 to remove the rightmost digit. Make sure to solve the previous problems first.

Input

A line containing two integers separated by a space.

2·124218

Output

A line containing an integer.

2

Create a program that will ask the user to input 9 integer numbers and display its vertical and horizontal sum. The numbers should be encoded in a 3 rows and 3 columns manner. After the user entered each set of numbers in a row, the horizontal sum of the set of numbers should automatically be shown.



Write a C Program to calculate the Average of an array elements where the elements are received as input.


Write a C program to input number from user and check number is palindrome or not using while loop.


Looping a number and taking away each digit of it is so much fun, but I wanted to try out a much more complex task: getting the largest digit among them all.

Think you can handle the job?


Instructions:

  1. Input a non-zero positive integer.
  2. Using the same concept as the previous problem, figure out how to separate the digits of a number and determine which of the digits is the largest one, using a while. Afterwards, print the largest digit.
  3. Tip #1: Create another variable that will hold the largest digit. Initial its value to a negative integer, like -1, outside the loop.
  4. Tip #2: Everytime you get the rightmost digit, check if it is greater than the current largest digit. If it is, set it as the new largest digit.

Input

A line containing an integer.

214

Output

A line containing an integer.

4




Are Characters Created Equally?

1. What do you mean by Program? Briefly describe the basic structure of C programs.

2. What is a token? Differentiate between a for loop and a while loop? What are it uses? 

3. What is a data type? Differentiate between array and pointer. Write a program to interchange 2 variables without using the third one. 

4. What is an array of pointers? Is it possible to have negative index in an array? Why is it necessary to give the size of an array in an array declaration?  

5. Submit a Report "the impact of improving debugging skill on programming ability".


LATEST TUTORIALS
APPROVED BY CLIENTS