Given a four digit number N as input write a program to print first and last digit of the number
Quite tiring to write those things separated by commas and a single space, isn't it?
Then let's try coding it instead
Five lines containing a string on each.
A single line containing all the strings separated by a comma and a space.
Have you ever answered a test question that tells you to enumerate a series of things, but the answer must be in a sentence? Quite tiring to write those things separated by commas and a single space, isn't it?
Then let's try coding it instead
Given a list of integers, write a program to print the count of all possible unique combinations of numbers whose sum is equal to k.
Input:
The first line of Input will contain space-separated Integer.
The second line of Input will contain an 8nteger,denoting K.
Sample Input:
2 4 6 1 3
Output:
3
Describe Min-Max Algorithm. Apply Min-Max Algorithm on the following tree:
Example:
Starting num = 2
Next num = 3
It should then print 3 4 5
Given code:
#include <iostream>
using namespace std;
void slowDisplay(int, int);
int main(void) {
int start, nextCount;
cout << "Enter starting integer: ";
cin >> start;
cout << "Enter how many next integers: ";
cin >> nextCount;
slowDisplay(start + 1, nextCount);
return 0;
}
void slowDisplay(int start, int nextCount) {
// TODO: Add the base case here
if(start == 0) {
cout << start << " ";
slowDisplay(start + 1, nextCount - 1);
}
}
To do: Print the string repeatedly, each time it prints the string, exclude the last letter until only 1 letter is left.
Given code:
#include <iostream>
#include <cstring>
using namespace std;
#define STR_MAX_SIZE 100
void preserveString(char*, int);
int main(void) {
char str[STR_MAX_SIZE];
cout << "Enter string: ";
fgets(str, STR_MAX_SIZE, stdin);
preserveString(str, strlen(str));
return 0;
}
void preserveString(char *str, int size) {
if(size > 0) {
for(int i = 0; i < size - 1; i++) {
cout << str[i];
}
cout << endl;
// TODO: Add the recursive case of the function here
}
}
#include <iostream>
ung namespace std;
#include <string> class snident
string name="DefaultName":
string birthyear= "9999":
Your Code Here
int main(){
sident $1;
student $2("Geoffrey Hinton"); student $3("Yann LeCun", "1960");
s1.print_info(); print_info();
$3.print_info():
$2.change year(1947");
s1 change_name("YourName");
s1.change year("YourBirth Year>");
$2.print info(); $1.print_info();
return 0;
Complete the student class so the main function above produces the following output:
Name: DefaultName, Birth Year: 9999
Name: Geoffrey Hinton, Birth Year: 9999.
Name: Yann LeCun, Birth Year: 1960 Name: Geoffrey Hinton, Birth Year: 1947.
Name: YourName, Birth Year: <Your Birth Year>
Consider a problem of an agent depositing an already issued book in library and then issuing a new book. List (i) predicates (ii) actions (iii) pre-conditions (iv) effects for the aforementioned planning problem.
• Using Php Script write a program that will compute the students average
• The user will input the following:
Name
Math
Science
English
• If the average is equal and above 75, it will display “Congratulations. You passed the semester” otherwise “You failed the semester.”