int GreaterThan(int no) a. { if (no > 10) printf("%d is greater than 10", no); else printf("%d is less than 10", no); }
Q: A method may accept any number of values, including zero O True O False
A: True
Q: public static int sum(int low, int high) { if (low > high) { return 0; } if (low % 3 == 0 && low % 2…
A: public static int sum(int low, int high){ int total=0; while(low<high){…
Q: for (int i = = 0; i <= 8; i++) int squared = i * i; System.out.println (i + " + squared, 11 squared…
A: answer: variable scope error explanation: the variable which is declared inside a loop which can…
Q: def foo(arg): if isinstance (arg, -): 11 oops return 'yeah' else : oops yeah return 'oops' 12 print…
A: Here, Code is given.
Q: int s-16; int k-1; for (int i-e; i<5; i++) for(int j=0; j<s; j++) printf(" "); S=s-4; for (int j-e;…
A: Correct Option - Option 3
Q: include int main() { int M; printf("Enter the number of chairs you want to…
A: As your question , i run the code i got two issue in the given code:…
Q: Electrical resistors are said to be connected "in series" if the same current passes through each…
A: Hello student Greetings Hope you are doing great. Thank You!!!
Q: following
A:
Q: In code below k = int i=2.j,k; j = i+1; k = i*j; cout<<k;
A: Given Code Snippet: int i=2,j,k; j = i + 1; k = i * j; cout<<k; We have to find…
Q: Assignment Write a program that moves a forester unit and a desert corps unit to a given target…
A: Assignment Write a program that moves a forester unit and a desert corps unit to a given target…
Q: /** * calculate the product of numbers from start to end inclusive e.g. * calcProductOfRange(3, 6) =…
A: Code in java but if the result of the product is out of range then it will print 0; class…
Q: Movies always come with ratings. A bad movie may have 1.4 stars, and a great movie may have 4.9…
A: EXPLANATION - Math round () - In java language there is special method available for mainly rounds…
Q: Part One: Create a method which takes two int parameters and swaps them. Print the values before and…
A: All the three methods are implemented in same program as follows
Q: In C++ class rectangleType { public: void setLengthWidth(double x, double y); //Sets the…
A: A C++ program to compute the area and perimeter of a rectangle using class structure.
Q: Exercise 1 Create a method that takes a value and indicate whether it is positive or negative by a…
A: import java.util.Scanner; public class Main{ public static boolean isPositive(int a) {…
Q: * If MyNumber = 6.8, what is the value of ?Int(My Number * 4^2)
A: MATLAB doesn't have the Int() function as described in the question, instead Matlab has int8 and…
Q: Write an application that allows you to enter nine(and only nine, no more no less) integers and…
A: Introduction of the Program: The Java program takes 9 integers from the user as input and then the…
Q: def foo(num): if (num<=0): return else: print(num/2,end=" ") foo(int(num/2)) print(num/2,end=" ")
A: To do: Output of the given code
Q: Q1) (40 points) Write a method that generates and outputs a random permutation of numbers between 1…
A: Code
Q: (Number of days in a year) Write a method that returns the number of days in a year using the…
A: public class Solution { public static boolean isLeayYear(int y) { // if leap year…
Q: Write an application that allows you to enter nine integers and displays the values, their mean, and…
A: Mean is also known as average. The mean of n integers is calculated by adding all the n integers and…
Q: int z = 2.2; %3D if(x 3) z = X + y; if(z > -1){ cout <« "z is " + y; } else cout <« "z is + z;
A: int z = 2.2 would result in z = 2 as decimal would be ignored. And instead of + I am taking <<…
Q: "roblem #1: 120 ptsl Ve need a program that calculates a medicine dosage by age. The following table…
A: According to the question we have to code in C of following question:
Q: using namespace std; eint div_2(int a){ if(a%2==0){ return 1; return -1; } 4} evoid div_6(int b){ }…
A: Program always start frommain function. main function call div_6(12) and it pass 12 to the function.…
Q: int z=3, s um =0; while (z<7) { Z+=2; Sum-Cumt7 .
A: The answer is as follows:-
Q: char t1[5] = "good"; char t2[5] = "boys"; char t3[15]; strepy (t3, t1); int nl = strlen (tl); int n2…
A: Description. 1- The output will come goodgood. How? 2- char t1[5] = "good"; // t1 is the string…
Q: This method returns a string with a number of vertical bars that correspond to the bars parameter.…
A: GIVEN: Create a method that returns a string with a number of vertical bars that correspond to the…
Q: #include int main() { int score = 70; int attendance = 1; int pass_the_course = 0; if (attendance…
A: To do: Fill the blanks of code
Q: Java Your program will read in a credit card number and expiration date from the user and validate…
A: The program makes use of Scanner class defined inside java.util package. The syntax for it is:…
Q: Find error in program include void main() { int x = 10; int y = 15; printf("%d", (x, y)) }
A: The error is at line no. 4: In this line the semi-colon is missing at the end. Below is the correct…
Q: #include int mystery (int n) { if (n<=0) return 1; else return ( 3 + mystery (n-1)); void main()…
A: The program computes the value of i if it is greater than 0. It adds 3 for every recursive call. The…
Q: void (double a) cout<<"" a = "; cout<<a<<endl; ... %3D
A: Given:
Q: T/F 2) The following method lacks a base case. public int noBaseCase(int x) { if(x > 0) return…
A: Given that, The following method lacks a base case.public int noBaseCase(int x){if(x > 0)return…
Q: void func1(int&); void func2(int&, int&); void func3(int, int); eint main(){ int x = 0, y = 0, z =…
A: Introduction of the Program: The C++ program is an example of pass by reference where the reference…
Q: static void try( int data %3D System.out. ) catch (Arithmet System.out. }finally {
A: public class Main {public static void main (String [] args) {try {int data =…
Q: Java Class: Fundraiser You are a fundraising distributor who needs to to pre-sell a limited number…
A: A java program is defined as a class with a main function defined inside the class. The main program…
Q: Find the errors in this code: double gpa[] = {2.2, 3.8, 4.0, 3.6, 1.7, 2.8}; int countSuper = 0;…
A: Find the errors in this code: double gpa[] = {2.2, 3.8, 4.0, 3.6, 1.7, 2.8}; int countSuper = 0; //…
Q: 5-3) (Find the highest score) Write a program that prompts the user to enter the number of students…
A:
Q: int sum(int x, int y) - returns the computed sum of two integers x and y int diff(int x, int y) -…
A: the program is given below :
Q: int age = getAge(); /*get age as input from the user*/ void display (int age); /*prints the…
A: Hi there, Please find your solution below, I hope you would find my solution useful and helpful.…
Q: Trigonometric method draw circle full code program ask User (Xc,Yc,radius r) in main class
A: Trigonometric method draw circle full code program ask User (Xc,Yc,radius r) in main class Since…
Q: 4) Roll the dice 2 Make a program that tests the probability of a certain score when rolling x dice.…
A: Programming language is Visual Basic.NET Steps to create a visual basic.net project to perform the…
Q: Find the error(s) in the following code snippet and explain how to correct it (them): 1 class…
A: The function prototype of getIncrementedData is : int getIncrementedData() const {} which makes is…
Q: Declare an int constant minutesPerHour whose value is 60
A: #include <iostream>using namespace std; int main() { const int minutesPerHour = 60; const…
Q: What is wrong in the following code?
A: In the given image (a): The Class circle has an object c1 but when declaring the object “( )” has…
Q: T/F 2) There is no base case in the following method. public int noBaseCase(int x) { if(x > 0)…
A: Given that, There is no base case in the following method. public int noBaseCase(int x){if(x >…
Q: for (int value=3; pow (2, value) <=100; value++) cout << pow (2, value) << ": ";
A: CONCEPT: - pow function It is present in cmath library. It takes two arguments namely base and…
Q: int count = for(int i = 0; i < 10; i++) for(int j = 0; j < i; j++) count++;
A: The value of the count after this code is run is 45. For proper explanation please refer to the…
Step by step
Solved in 2 steps
- int test(int *x, int y){ x=&y; return(*x+y); } int main(void) { int x=1, y=6; test(&y, x); printf("%d %d %d", x, test (&y,x),y); return 0; } 1 2 6#include<stdio.h>#include<stdlib.h> int cent50=0;int cent20=0;int cent10=0;int cent05=0; void calculatechange(int* change){if(*change>0){if(*change>=50){*change-=50;cent50++;}else if(*change>=20){*change-=20;cent20++;}else if(*change>=10){*change-=10;cent10++;}else if(*change>=05){*change-=05;cent05++;}calculatechange(change);}}void printchange(){if(cent50)printf("\n50cents:%d coins",cent50);if(cent20)printf("\n20cents:%d coins",cent20);if(cent10)printf("\n10cents:%d coins",cent10);if(cent05)printf("\n05cents:%d coins",cent05);cent50=0;cent20=0;cent10=0;cent05=0;}void takechange(int* change){scanf("%d",change);getchar();}int main(){int change=0;int firstinput=0;while(1){if(!firstinput){printf("\nEnter the amount:");firstinput++;}else{printf("\n\nEnter the amount to continue or Enter -1 to…#include<stdio.h>#include<stdlib.h> int cent50=0;int cent20=0;int cent10=0;int cent05=0; void calculatechange(int* change){if(*change>0){if(*change>=50){*change-=50;cent50++;}else if(*change>=20){*change-=20;cent20++;}else if(*change>=10){*change-=10;cent10++;}else if(*change>=05){*change-=05;cent05++;}calculatechange(change);}}void printchange(){if(cent50)printf("\n50cents:%d coins",cent50);if(cent20)printf("\n20cents:%d coins",cent20);if(cent10)printf("\n10cents:%d coins",cent10);if(cent05)printf("\n05cents:%d coins",cent05);cent50=0;cent20=0;cent10=0;cent05=0;}void takechange(int* change){scanf("%d",change);getchar();}int main(){int change=0;int firstinput=0;while(1){if(!firstinput){printf("\nEnter the amount:");firstinput++;}else{printf("\n\nEnter the amount to continue or Enter -1 to…
- #include<stdio.h>#include<stdlib.h> int cent50=0;int cent20=0;int cent10=0;int cent05=0; void calculatechange(int* change){if(*change>0){if(*change>=50){*change-=50;cent50++;}else if(*change>=20){*change-=20;cent20++;}else if(*change>=10){*change-=10;cent10++;}else if(*change>=05){*change-=05;cent05++;}calculatechange(change);}}void printchange(){if(cent50)printf("\n50cents:%d coins",cent50);if(cent20)printf("\n20cents:%d coins",cent20);if(cent10)printf("\n10cents:%d coins",cent10);if(cent05)printf("\n05cents:%d coins",cent05);cent50=0;cent20=0;cent10=0;cent05=0;}void takechange(int* change){scanf("%d",change);getchar();}int main(){int change=0;int firstinput=0;while(1){if(!firstinput){printf("\nEnter the amount:");firstinput++;}else{printf("\n\nEnter the amount to continue or Enter -1 to…#include<stdio.h>#include<stdlib.h> int cent50=0;int cent20=0;int cent10=0;int cent05=0; void calculatechange(int* change){if(*change>0){if(*change>=50){*change-=50;cent50++;}else if(*change>=20){*change-=20;cent20++;}else if(*change>=10){*change-=10;cent10++;}else if(*change>=05){*change-=05;cent05++;}calculatechange(change);}}void printchange(){if(cent50)printf("\n50cents:%d coins",cent50);if(cent20)printf("\n20cents:%d coins",cent20);if(cent10)printf("\n10cents:%d coins",cent10);if(cent05)printf("\n05cents:%d coins",cent05);cent50=0;cent20=0;cent10=0;cent05=0;}void takechange(int* change){scanf("%d",change);getchar();}int main(){int change=0;int firstinput=0;while(1){if(!firstinput){printf("\nEnter the amount:");firstinput++;}else{printf("\n\nEnter the amount to continue or Enter -1 to…int pertambahan(int pilihan, int now){ int result; result =pilihan + now; return result;} int perkalian(int pilihan, int now){ int result; result = pilihan*now; return result;} int main(){ int NoR,initial; int now; int temp1, temp2; scanf("%d %d", &NoR, &initial); getchar(); now=initial; for(int o=0;o<NoR;o++){ char a,b; int pilihan1,pilihan2; scanf("%c %d %c %d",&a, &pilihan1,&b, &pilihan2); getchar(); if(a=='+') { if(pilihan1>=-1000 && pilihan1<=1000) { temp1 = pertambahan(pilihan1,now); } else{ temp1=-10000; } } else if(a=='x') { if(pilihan1>=-2 && pilihan1<=2){ temp1 = perkalian(pilihan1,now); } else { temp1=-10000; } } if(b=='+') { if(pilihan2>=-1000 && pilihan2<=1000) { temp2 = pertambahan(pilihan2,now); } else {…
- Part 2 - OddOrEven ClassWrite a program that prompts the user to enter an integer. The program should display “The input is odd" to the screen if the input is odd and displays “The input is even" to the screen if the input is even. Hint: Consider using the mod (%) operatorint a = 9; int c = 6; int d = 6; boolean m; if (a==c && c != d) { m = true}; What is the value of m? True False 6 9int main(){ long long int total; long long int init; scanf("%lld %lld", &total, &init); getchar(); long long int max = init; long long int min = init; int i; for (i = 0; i < total; i++) { char op1 = '0'; char op2 = '0'; long long int num1 = 0; long long int num2 = 0; scanf("%c %lld %c %lld", &op1, &num1, &op2, &num2); getchar(); long long int maxr = max; long long int minr = min; if (op1 == '+') { long long int sum = max + num1; maxr = sum; minr = sum; long long int res = min + num1; if (res > maxr) { max = res; } if (res < minr) { minr = res; } } else { long long int sum = max * num1; maxr = sum; minr = sum; long long int res = min * num1;…
- Number of digits int main() {int c=0;int i=3856; int l=i; while(l>0) {l=l/10; c++; } printf("%d",c); return 0; } Summation of digits int main() {int sum=0; int i=384; int l=i; while(l>0) { sum+=l%10; l=l/10;} printf("%d",sum); return 0; }SEE MORE QUESTIONS