ii. Fill in the blanks under “Times" column and provide the final Big O. Code Cost Times int i; cl for (int i=1; i<=n; i=i*2) { c2 int j=1; c3 while (j <= n*n) { c4 j=j+n; c5
Q: #include main () { int i, j; for(i=5, j=1; i>j; i--, ++j) printf("%d %d ", i,j);
A: C is a flexible programming language that can be used for a variety of tasks. It can be used to…
Q: Trace the following programs and write the generated output: #include using namespace std; class B{…
A: Given: #include<iostream> using namespace std; class B { public: char c; float b;…
Q: Examine the following code segment. What will be printed? If there are any errors indicate the…
A: Errors in program: Variable “i” which is used for loop traversing is not declared. This error is…
Q: Q3: Write a computer program in FORTRAN 90 to input the coordinates (x and y) of n points. The…
A: To find if n points lie in the second quarter or not. For a point to lie in second quater, its x…
Q: 13) What does the following code do? int value1 = Keyboard.readInt( ); int value2 =…
A: Question 13. What does the following code do? int value1 = Keyboard.readInt( ); int value2 =…
Q: Q3: b-Write a program in (Fortran 95) to find the value of W from the following equations. If X is…
A: We need to write a Fortran 95 code for the given scenario.
Q: Example 05 Assume the definitions and initializations: char c = 'T', d = 'S'; char "pl = &c; char…
A: The output of the program is given in step 2.
Q: Consider the following code segment if (n != 0 && x / n > 100) statement1; else statement2; If n is…
A: The if/else statement executes a block of code if a specified condition is true. If the condition is…
Q: rogram for the longest sequence of increasing numbers. Use the function: void longestSequence(int…
A: I have written below the C program for the longest sequence of increasing numbers. Use the function:
Q: QUESTION 10 def cube (number): for i in range (number, number): for j in range (number) : print…
A: In place of FILL THIS PART just write number*number*number Hence the answer to be filled in the box…
Q: What is the use of line number 11 3 using namespace std; 4 int min(int x,int y) 50 { 6 cout>>>>y; 13…
A: Given C++ program contains, A min function with variables x, y and in this function the value of x/y…
Q: main () { int x, y, z,M; x=0; y=1;z=1; M=++x || ++y && ++z; cout<<"M="<<M; }
A: { Int x, y, z ,M X=0; y=1;z=1; M=++x || ++y && ++z; Cout << “M=”<<M; }
Q: 4) write down whether the following statements is valid or not valid int i=11, m-51%; int *pl, *p2,…
A: Only the second statement is valid.
Q: 8. Determine the value of variable num1, num2 and num3 at the end of the following code. int…
A: #include<stdio.h>int product(int A, int *B) /* function definition. As at the time of calling…
Q: int i,j; for(i=1;ii;--j) cout<<"-"; } **_* ** **. ***.
A: CODE WITH OUTPUT:-
Q: 6: forLoops.cpp) a) Print the even numbers between 3 and 43. b) Print every third letter starting…
A: void a() { int i; cout << "a() ->" << endl; for(i = 4; i < 43; i += 2) { cout…
Q: Question 1. Read the below C program and answer the following questions. #include char…
A: We are given a C code and based on that bunch of questions been asked like how many functions are…
Q: i. The number of distinct combinations of n objects, taken rat a time, is determined by the…
A: I give the code in Java along with output and code screenshot
Q: (c) What are the values of the variables incr, de cr, and total after the following code fragment is…
A:
Q: 1. Write a program that calculates the user's body mass index (BMI) and categorizes it as…
A:
Q: 3. Trace the given code and write the output. #include using namespace std; int main() int resp…
A: The above code output and explanation is given in step 2:-
Q: 30 Suppose a, b, and sum are int variables and c is a double variable. What value is assigned to…
A: Given: Suppose a, b, and sum are int variables and c is a double variable. What value is assigned to…
Q: In an ancient land, the beautiful princess Eve had many suitors. She decided on the following…
A: Iam using list instead of vector. c++
Q: Q3/B/ Write a program in C++ to read an integer number then find the area or circumference of a…
A: Since Algorithm is already given in the problem, I am not writing it. Program: #include…
Q: EXPLAIN THIS CODE EACH LINE #include #include int main() { char name[20]; int…
A:
Q: (4) char chArray[] = {'E', T, 'C', 'D', 'F', 'F'}; (5) int a 5, b-7, c; after the statement…
A: Correct General statement for any array in C is <datatype> <variable_name>[] =…
Q: (b) Below is part of a code, consider this program and show where each part of code is saved in the…
A: Given: Below is the part of a code , Consider this program and show where each part of code is…
Q: The problem statement is described in the problem_statement.pdf file. Write the solution into the…
A: Below i have answered:
Q: This error occurs when a value is not available to a .function or formula #REF!. O #NULL!. O #N/A O
A: Given, This error occurs when a value is not available to a function or formula #REF! #NULL! #N/A
Q: int sum = (int)33.9%3B The above statement is an example for O a. Explicit Casting Ob Type Filtering…
A: - We need to highlight the correct option--out of the provided ones for the statement. - The…
Q: 5. Given variables int areaBound and int sum, write a snippet of code that assigns to sum the result…
A: Here in this question we have asked to write a snippet of code that use while loop and Initially…
Q: 3. Write a program to calculates the sum, and an average of the values of your student ID number,…
A: The problem is based on finding the sum and average of the given student id. NOTE: The result is…
Q: int i,j; for(i=0; i< 5; i++) for(j=0;j<=i;j++)
A: C# Correct program: using System;class HelloWorld { static int Main() { int i,j; for(i=0;…
Q: Check if number is prime
A: This is very simple. I have written a simple Python code to solve the problem. I have also attached…
Q: 4. Using the machine language introduced in the class, write a program that multiplies the numbers…
A: program of multiplication of matricies:
Q: (c) What are the values of the variables incr, decr, and tot al after the following code fragment is…
A: As per our policy, "Since you have asked multiple questions, we will solve the first question for…
Q: 10 نقاط Trace the following program showing the values of i, j, and z ?at each step void main() {…
A: Step1: i=0 j=0 j<=4 z=z+(i*j)=0 j++ => j=1 z=0 j++ => j=2 z=0 j++ => j=3 z=0 j++ =>…
Q: Consider the following C++ code snippet and choose the best statement below. char slogan = "Go…
A: Single quote (' ') is used to identify a single character, while double quotes (" ") are used for…
Q: Trace the following code by showing the values of the 3 variables in the table on the right, for…
A: Code -----------------> x y z var x = 5; -----------------> 5 N/A N/A var y = 10;…
Q: 3. #include using namespace std; int add (int x, int y, int z) return x + y + z; int multiply(int…
A: According to the Question below the Solution:
Q: 6. Analyze the following code. int x = 0; if (x > 0); { System.out.println("x"); } a. The value of…
A: 6). (c) The symbol x is always printed. Here, the the x is always greater and you can see in the…
Q: Exercise # 2: Write a C positive integer value gr it is a positive integer th n(n+1) value to and…
A: Code :- #include <stdio.h> int main(void) { int n; while(1) { printf("Enter an…
Q: can you make a flow chart of this: #include int main(){ int num1, num2;…
A: #include <stdio.h> int main(){ int num1, num2; for(num1 = 1; num1 <= 10;…
Q: Analyze the following code segments and find the output
A: #include <iostream> using namespace std; int main(){ int data [] = {16, 20, 57, 40, 127};…
Q: 3.12 LAB: Input and formatted output: House real estate summary Sites like Zillow get input about…
A: Coded using Python 3.
Q: 3. After execution of the following code, what is stored in valueNum? All variables are using data…
A: The correct option is option b which is the largest value of num1,num2, and num3. The value stored…
Q: int i, n; // initialize first and second terms int t1 = 0, t2 = 1; // initialize the next term (3rd…
A: Converting following c program into MIPS instructions
Q: Task 4. Write a program to print all prime numbers within a range. Note: A Prime Number is a number…
A: Answer: Code to print all the prime numbers within a range are: a = int(input("Enter starting…
Q: Assuming x (type double) is 12.335 and i (type int) is 100, show the lines displayed by the…
A: Find Your Answer below
Q: Question #1 Study the following C program and answer the below questions Hint: you might run it in…
A: Given:
Step by step
Solved in 2 steps with 3 images
- Question 3. Read the below C program and answer the following questions. #include <stdio.h> char read_letter(); void pattern(int rows, int cols, char letter); int main(void) { int rows, cols; char letter; letter = read_letter(); printf("Enter the number of rows: "); scanf("%d",&rows); printf("Enter the number of columns: "); scanf("%d",&cols); pattern(rows, cols, letter); return 0; } char read_letter() { char letter; printf("Enter the first letter of your name: "); scanf("%c",&letter); return letter; } void pattern(int x, int y, char letter) { int i, j; printf("\n"); for (i = 0; i <x; i++) { for (j = 0; j <y; j++) { printf("%3c",letter); } printf("\n"); } return; }#include <iostream>using namespace std; struct Person{ int weight ; int height;}; int main(){ Person fred; Person* ptr = &fred; fred.weight=190; fred.height=70; return 0;} What is a correct way to subtract 5 from fred's weight using the pointer variable 'ptr'?Question 1. Read the below C program and answer the following questions. #include <stdio.h> char read_letter(); void pattern(int rows, int cols, char letter); int main(void) { int rows, cols; char letter; letter = read_letter(); printf("Enter the number of rows: "); scanf("%d",&rows); printf("Enter the number of columns: "); scanf("%d",&cols); pattern(rows, cols, letter); return 0; } char read_letter() { char letter; printf("Enter the first letter of your name: "); scanf("%c",&letter); return letter; } void pattern(int x, int y, char letter) { int i, j; printf("\n"); for (i = 0; i <x; i++) { for (j = 0; j <y; j++) { printf("%3c",letter); } printf("\n"); } return; } List all the functions that have been uses in the code and mention their type. Explain the commands that have been executed by each function. Explain the loop part and explain how to calculate the number of iterations. Run the given…
- EXPLAIN THIS CODE EACH LINE #include <stdio.h>#include<string.h>int main(){ char name[20]; int meal,quantity; int drink,quantity2; char choose_meal[30] = ""; int meal_price; float drink_price, orderPrice; char choose_drink[30] = ""; float cash, change; printf("--------------------Marry's Fast Food--------------------"); printf("\n"); printf("Enter your name: "); scanf("%s", name); printf("Hello %s!\n", name); printf("\n\nWhat would you like to order?\n"); printf("------------------------MEALS------------------------\n\n"); printf("[1] 1 pc. Chicken Joy....................Php 76.00\n"); printf("[2] 1 pc. w/Jolly spaghetti..............Php 99.00\n"); printf("[3] pc. Spaghetti........................Php 55.00\n"); printf("[4] pc. Burger steak w/rice..............Php 85.00\n"); printf("[5] pc. Burger...........................Php 30.00\n\n"); printf("Choose a number…Please fill in the blanks for C /* Print full name*/ #include<stdio.h> #include<stdbool.h> __1__ scan_print_name(__2__ size, __3__ name[size]); // function header int main() { int len; bool isDone = false; //default to false since it's not done without running char enter; //this is to avoid the first getChar captures the enter from length //Get name and redo them over and over till the name length is big enough // isDone is our flag to know if we need to run again. // isDone == true means we are done, and vice versa do { printf("\nEnter your full name's length."); printf("Make sure to count spaces and null character:"); scanf("%d%c", &len, &enter); char fullName[len]; isDone = scan_print_name(len, fullName); }while(!isDone);…def sparechange(quarters, dimes, nickels, pennies): spareAMT = 25 * quarters + 10 * dimes + 5 * nickels + 1 * pennies print("The total value of your change is $%.2f "%(spareAMT/100)) uses import.sys and sys.argv[ ] to run code
- C++ is my answers correct ? Write a function to convert a decimal number to a binary number. Answer: #include <iostream> #include <string> using namespace std; string decToBin(int dec) { string bin = ""; while (dec > 0) { bin = to_string(dec % 2) + bin; dec /= 2; } return bin; } int main() { cout << decToBin(10) << endl; return 0; } Write a function to calculate s =1!+2!+3!+....+10! Answer: #include <iostream> using namespace std; int findFactSum(int n) { int f = 1, Sum = 0; for (int i = 1; i <= n; i++) { f = f * i; Sum += f; } return Sum; } int main() { int n = 10; cout << findFactSum(n); return 0; }Please make the modifications in "C programme" and try to complete all three parts kindly. #include<stdio.h> #include<string.h> struct library{ int id; char title[40]; char author[20]; float price; } b[100] ; int num=0; void Add(){ printf("How many books' info do you want to enter? "); scanf(" %d",&num); for(int i=0;i<num;i++){ printf("Enter the following information about the book:\n"); printf("ID, title, author's name, price(in Tk)\n"); scanf(" %d %s %s %f",&b[i].id,&b[i].title,&b[i].author,&b[i].price); } } void Disp(){ printf("\tID\tName\tAuthor\tPrice(Tk)\n"); for(int i=0;i<num;i++){ printf("\t%d\t%s\t%s\t%f\n",b[i].id,b[i].title,b[i].author,b[i].price); } } void Count(){ printf("\nNo of books avalable in the library = %d\n",num); } void List(){ char str[20]; printf("Enter the author's name: "); scanf("%s",str); for(int i=0;i<num;i++){ if(strcmp(str,b[i].author)==0)…Please fill in the blanks for C, from 1 to 68. /*The program will get the information of each client and print it right back. We could get the information of all clients first, then print them all later for better readability using an array of struct.*/ #include<stdio.h> #include<stdbool.h> #define length 70 //assume there's no names longer than 70 /*It's good practice to add all function headers to the top of the program*/ __1__ __2__ getEmployeeInfo(); __3__ printEmployeeInfo(__4__ __5__ em); __6__ __7__ getClientInfo(__8__ i); __9__ printClientInfo(__10__ __11__ cli, __12__ i); /*Employee struct: all the arrays use the same constant size defined on top name-first, last-(string) title (string) number of clients (integer) number of years working at the company(can take decimal points). */ __13__ employee { __14__ first_name[__15__]; __16__ last_name[__17__]; __18__ title[__19__]; __20__ num_clients; __21__…
- Computer Science In a file named Exercise2.c write the function double sum(double (*f)(double), int start, int end); The call sum(g,i,j) should return g(i)+…+g(j). Add a main function to illustrate the use of your implementation of sum applied to sqrt from 1 to 10.Create union floating point with members float f, double d and long double x. Write a program that inputs values of type float, double and long double and stores the values in union variables of type union floating point. Each union variable should be printed as a float, a double and a long double. Kindly check if the values always print correctly?using c++ #include <iostream> using namespace std; int main() { int n = 5; for (int row = 0; row < n; row++) { for (int col = 0; col < n; col++) { cout << "*"; } cout << endl; } } ) SecondTriangle. Using the above square code, write a code fragment secondTriangle that reads in an integer n and displays the following triangle assuming n=5. The only couts you may use are cout <<“*”, cout <<”-“, and cout << endl;. Hint: write out a table showing for each row, how may columns you will need to display. ----*---**--***-*********