Make me a program that accepts a random string (a series of characters). Then, look for a digit from that string and if there's at least one, print out "That one!" but if there's none, print out "No one..."
I know this is too sudden to ask you, but thank you in advance!
Tip: After your scan for the size, add a space after the placeholder like this so that the newline character directly after the number won't be scanned as one of the characters:
scanf("%d ", &size);Input
1. Size of the string
2. Characters of the string
Output
The first line will contain a message prompt to input the size of the string.
The second line will prompt for the characters of the string.
The last line contains the appropriate string.
Enter·the·size:·18
Enter·the·characters:·CodeChum1sAwesome!
That·one!We've already made arraying/listing the easy way, but how about arraying/listing and printing the list in reverse order?
Make a program that will input an integer and then using loops, add items on an array/list one by one for the same number of times as that of the first inputted integer. Then, print out the array/list in reverse order, that is, starting from the last item on the array/list down to the first one, each in separated lines.
Input
1. Size of the array
2. Elements of the array
Output
The first line will contain a message prompt to input the size of the array.
The succeeding lines will contain message prompts to input the elements of the array.
The next lines will contain the elements of the array in reversed order.
Enter·the·size:·5
Element·#1:·1
Element·#2:·64
Element·#3:·32
Element·#4:·2
Element·#5:·11
Reversed·Order:
Element·#1:·11
Element·#2:·2
Element·#3:·32
Element·#4:·64
Element·#5:·1
How to print triple slash in codechum
“If the height of a tree is reduced and balanced, then the searching time
also get reduced.” (True/ False) Justify. Construct a B-tree of order three with
the following set of elements where the elements are added to the tree one
after the other in the given sequence.23, 64, 48, 96, 101, 34, 55, 11, 22, 41,
89, 71, 78, 61, 83, 94, 8, 27, 35, 1.
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:
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:
The students of Dr. Kyle have submitted an unique string that Dr. Kyle gave them for homework. He is checking the strings of student A and student B which are denoted as and . Dr. Kyle wants to find out if they copied each other's work. If the string can be transformed into string with rotations, it'll be obvious to Dr. Kyle that they have cheated.
Write a C program to check whether the given number is equal or not equal using if, if else
Write a C program to check whether the given number is odd or even using if,if else
enter the code:
Write a short reflective account of the code concentrating on its functionality and comparing the outputs against the source code.
#include <stdio.h>
int main(int argc, char *argv[]) {
int a, b;
// Obtain values for a and b
printf("Enter the value for integer a: ");
scanf("%d", &a);
printf("Enter the value for integer b: ");
scanf("%d", &b);
printf("\n\n");
// Compare a and b
if (a == 42 && b == 216)
{
printf("Password correct");
}
else if (a > b) // Testing for a greater than b
{
printf("a (%d) is bigger than b 0(%d)\n", a, b);
}
else if (a == b) // Testing for equality
{
printf("a (%d) is equal to b (%d)\n", a, b);
}
else // Otherwise a must be less than b
{
printf("a (%d) is less than b (%d)\n", a, b);
}
system("pause");
return 0;
}