C program to check whether a number can be expressed as sum of two prime number using function
Complete the function ‘find_path_dfs()’ which finds cost of going from the source vertex (src) to destination vertex (dst) using Depth First Search (DFS) algorithm. Use stack for implementing DFS algorithm.
void find_path_dfs(int * graph, int size, int src, int dst)
{
int visited[size] ={0};
struct node * top =NULL; //Make a stack for holding the visited vertices
int crnt_visiting =src;
int crnt_exploring =src;
int path_cost =0;
bool PATH_FOUND =false;
while(!PATH_FOUND)
{
visited[crnt_visiting] =1;
struct element temp;
if(crnt_visiting==dst) //If the vertex is found
{
printf("\nPath found: ");
printf("\nCost: %d\n", path_cost);
while(!isStackEmpty(&top))
{
printf("Pop\n");
pop(&top);
}
PATH_FOUND=true;
continue;
}
else //Explore this vertex
{ //Complete this function. You are free to make any changes to this function. Make sure that path cost is correctly found.
}}}
Write a c program to calculate sum of square root from 1 to n number.
Instructions:
Input
1. The starting point
2. The ending point
Output
The first line will contain a message prompt to input the starting point.
The second line will contain a message prompt to input the ending point.
The succeeding lines will contain the appropriate messages.
Enter·the·starting·point:·2
Enter·the·ending·point:·10
Loading...2%
Loading...3%
Loading...5%
Loading...6%
Loading...7%
Loading...9%
Loading...10%
We've already done looping through a series of numbers and printing out its squares, so how about we level it up and go with cubes this time?
I have a condition though; I don't want to be associated with numbers that are divisible by 3 or 5 so if an integer is divisible by either of the two, don't make their cube values appear on the screen, please.
Care to fulfill my request?
Instructions:
Output
Multiple lines containing an integer.
1
8
64
343
512
.
.
.
Input
1. The digit to be found
2. The integer to be searched
Output
The first line will contain a message prompt to input the digit to be found.
The second line will contain a message prompt to input the integer.
The last line contains the appropriate string.
Enter·the·digit·(0·-·9):·1
Enter·the·integer:·231214238
Yes
Test Case 2
Enter the digit (0 - 9): 0
Enter the integer: 123456
No
Let’s play a game of FizzBuzz! It’s quite the same with your childhood "PopCorn" game, but with a little bit of twist to align it with programming.
Are you ready?
Instructions:
Input
1. An integer
Output
The first line will contain a message prompt to input the integer.
The succeeding lines contain strings.
radio_button_unchecked
Test Case 1
Enter n: 15
Fizz
Buzz
Fizz
Fizz
Buzz
Fizz
FizzBuzz
radio_button_unchecked
Test Case 2
Enter n: 20
Fizz
Buzz
Fizz
Fizz
Buzz
Fizz
FizzBuzz
Fizz
Buzz
How to Attempt?
Charles and the Necklace
Charles wants to buy a necklace in which:
1. There is a minimum of 1 pearl and maximum of X pearls such that
each pearl has its own magnificent coefficient. 2. The pearls should be in non-decreasing order of their magnificence power.
You are given the maximum number of pearls in a necklace and the range of the magnificent coefficients of the pearls. Find the number of necklaces that can be made that follow the mentioned conditions.
Question 1
Revisit Later
Compil
How to Attempt?
Placement Season Begins
The placement season has begun in a college. There are N number of students standing outside an interview room in a line. It is given that a person who goes in first has higher chances of getting selected.
Each student has a number associated with them known as the problem solving capability (PSC). The higher the capability, the higher the chances of selection. Now, each student wants to know the number of students ahead of him/her who have more problem-solving capability than him/her.
Find this number for each student.
Input Specification:
input1: An integer N. which denotes the number of students present. input2: An array of size N, denoting the problem-solving capability of the students
Consider a square matrix A of size Nx N and an integer X which is an element of A. Find the row number R and column number C of X in A, and calculate the sum of Rand even, find the sum of the digits of all even numbers in the matrix, and if the sum is odd, then find the sum of digits of all odd numbers in the matrix.
Read the input from STDIN and print the output to STDOUT. Do not write arbitrary strings while reading the input or while printing, as these contribute to the standard outp
Constraints: 1) 1<N<= 35.
II) 0 <= RC < N.
III) X is always an element of A.
IV) Elements of A are unique.