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

Journey to Another Dimension

by CodeChum Admin

Somehow, in some way, you find yourself in a dimension within a dimension. Traverse the dimension and look for the exit!

Instructions:


Instructions

  1. Go through the 2D array and search for the array index containing the int value named “exit”.
  2. Print the indices with one space in between the column and row index.

Input

A single int input

1

Output

2 int outputs separated by a space

0·0




---------------to fill up code--------------------


#include<stdio.h>


int main() {

    int exit;

    scanf("%d", &exit);

    

    int col_row[5][5] = {{1,2,3,4,5},{6,7,8,9,10},

                        {11,12,13,14,15},{16,17,18,19,20},{21,22,23,24,25}};

    

    

}


Burning Bridges

by CodeChum Admin

After getting out of the strange dimension, you feel like you have to cover up your path and close the exit so that nothing strange can follow you back.


Instructions

  1. Change the value of of the element located in the array index indicated by the int variables “exitCol” and “exitRow” to ‘0’.
  2. Print out the 2D array with each element per row separated by a space and each column separated by a line.


Input

Two ints separated by a space

0·0

Output

5x5 array with each sub array in a new line and each element separated by a space

0·1·1·1·1
1·1·1·1·1
1·1·1·1·1
1·1·1·1·1
1·1·1·1·1


-----------fill up the code---------------

#include<stdio.h>


int main() {

    int exitRow,exitCol;

    scanf("%d %d", &exitRow,&exitCol);

    int row_col[5][5] = {{1,1,1,1,1},{1,1,1,1,1},{1,1,1,1,1},{1,1,1,1,1},{1,1,1,1,1}};

    


    return 0;

}


“If the height of a tree is reduced and balanced, then the searching time also get reduced.” (True/ False) Justify.

we need c coding with this answer..



Write a program that reads the numbers and sorts them by using the Counting


Sort algorithm and finally search a number from that array using Linear


Search Algorithm.


8


Input: 3 6 5 4 7 8 9


Search Item: 7


Output: Sorted Array: 3 4 5 6 7 8 9


Search item 7 is found.

Find latitude and longitude of 20 countries with a population greater than or equal to the population limit given below. Use the country details from this dataset.

Your task is to find the sum of the length of all lines (in kms) that can be drawn between co-ordinates of these countries.

  • Assume radius of earth: 6371 km
  • Round length of each line and final result to 2 decimal points
  • If co-ordinates are missing for any country use 0.000 N 0.000 E

Population limit: 300

Note: Population limit will change at random intervals. So please make sure answer is computed for the correct population limit before submitting.



write a program, When the racer is outside the covered section:


The audible warning must turn ON and OFF with the rear Light.


• When the racer is inside the covered section:


The audible warning must stay ON.


write a program, When the racer is outside the covered section:


The two headlights and the rear light must turn ON and OFF alternatively (when headlights are ON, the rear light must be OFF and vice versa) for 1 second in each state.


• When the racer is inside the covered section: The two headlights must turn ON and OFF alternatively for 0.5 seconds in each state. The rear light must stay ON for the whole duration. 


Sort It Yourself

by CodeChum Admin

A descending order means values arranged from largest to smallest. But in your case, you're going to have to sort these integers in ascending order, which means from smallest to largest.


Instructions:

  1. Input three integers.
  2. Print the integers in ascending order using your knowledge on conditional statements.

Input


1. First integer

2. Second integer

3. Third integer

Output


The first three lines will contain message prompts to input the 3 integers.

The last line contains the three integers in ascending order.


TEST CASES

Enter the first integer: 6
Enter the second integer: 1
Enter the third integer: 3
1 3 6


Enter the first integer: 6
Enter the second integer: 4
Enter the third integer: 2
2 4 6


Enter the first integer: 0
Enter the second integer: 2
Enter the third integer: 0
0 0 2


Enter the first integer: 1
Enter the second integer: 1
Enter the third integer: 1
1 1 1

an ecommerce website wishes to find the lucky customer who will be eligible for full value cashback. for this purpose, a number n is fed to the system. it will return another number that is calculated by an algorithm. in an algorithm, a sequence is generated, in which each number is the sum of the two preceding numbers. initially, the sequence will have two 1's in it. the system will return the nth number from the generated sequence which is treated as the order id. the lucky customer will be the one who has placed that order. write an algorithm to help the website find the lucky customer.


#include <stdio.h>


int main()

{

 int x[9];

 int res;

 

  printf("Input 9 integers:\");

 scanf("%d %d %d %d %d %d %d %d %d",&x[0],&x[1],&x[2],&x[3],&x[4],&x[5],&x[6],&x[7],&x[8]);

  

 printf("\%d\%d\%d = %d\",x[0],x[1],x[2], x[0]+x[1]+x[2]);

 printf("%d\%d\%d = %d\",x[3],x[4],x[5], x[3]+x[4]+x[5]);

 printf("%d\%d\%d = %d\",x[6],x[7],x[8], x[6]+x[7]+x[8]);

 printf("-------------------------\");

 res = x[0]+x[3]+x[6]+x[1]+x[4]+x[7]+x[2]+x[5]+x[8];

 printf("%d\%d\%d = %d",x[0]+x[3]+x[6],x[1]+x[4]+x[7],x[2]+x[5]+x[8],res);

  

 return 0;

}


LATEST TUTORIALS
APPROVED BY CLIENTS