Question

Write output of following program in C# afterremoving error if any. Note: Be sum of first two digit of your Roll no. Run the

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer

Let consider the rollnumber as 135, so sum of 1 and 3 is 4 , ie  \beta =4 .

so giving  \beta value as 4 in the code we get the output

Enter Student Name: Jhon Enter Student Age: 19 Enter Student Roll number: 135 Student class year: CS2020 Age Age Age Age 19 N

Here for loop will print Age Name R.no Class  \beta times. So if no change is possible to the code , the above output will be correct .

In my opinion , this for loop is not needed in this code , which makes the output wrong , so after removing it we will get the below output

Enter Student Name: Jhon Enter Student Age: 19 Enter Student Roll number: 135 Student class year: CS2020 Age 19 Name Jhon R.n

Add a comment
Know the answer?
Add Answer to:
Write output of following program in C# afterremoving error if any. Note: Be sum of first...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 61. The following program is accepted by the compiler:         int sum( int x, int y...

    61. The following program is accepted by the compiler:         int sum( int x, int y )         {             int result;             result = x + y;            }                            T__   F__ 62. The following implementation is accepted by the compiler:         void product()         {             int a; int b; int c; int result;             cout << "Enter three integers: ";             cin >> a >> b >> c;             result = a * b * c;            ...

  • Based on this program modify the source code so that it will able to save the student record into a database txt and able to display and modify from a database txt as well. you will also need to able...

    Based on this program modify the source code so that it will able to save the student record into a database txt and able to display and modify from a database txt as well. you will also need to able to modify the code so it will accept name such as "john kenny " and the progrom should also ask for the student id number. #include<iostream> #include<stdlib.h> using namespace std; struct st { int roll; char name[50]; char grade; struct...

  • Code in C++: Please help me fix the error in function: void write_account(); //function to write...

    Code in C++: Please help me fix the error in function: void write_account(); //function to write record in binary file (NOTE: I able to store data to a txt file but however the data get error when I try to add on data the second time) void display_all(); //function to display all account details (NOTE: This function is to display all the info that save account.txt which is ID, Name, and Type) void modify_account(int); //function to modify record of file...

  • This is for a C++ program: I'm almost done with this program, I just need to...

    This is for a C++ program: I'm almost done with this program, I just need to implement a bool function that will ask the user if they want to repeat the read_course function. I can't seem to get it right, the instructions suggest a do.. while loop in the main function. here is my code #include <iostream> #include <cstring> #include <cctype> using namespace std; const int SIZE = 100; void read_name(char first[], char last[]); void read_course(int & crn, char des[],...

  • what is the output for the following code? explain the steps. /*#include <iostream> using namespace std;...

    what is the output for the following code? explain the steps. /*#include <iostream> using namespace std; int f(int &i) { i = 10; return(5 * i); } int main() { int n = 5; f(n); cout << n << "\n"; return 0; } #include <iostream> using namespace std; int sub1(int n) { n--; return n; } int main() { int m = 10; for(int j = 0; j < 10; j++) m -= sub1(j); cout << m << "\n"; return...

  • please help me fix the error in here #include<iostream> #include <string> using namespace std; string getStudentName();...

    please help me fix the error in here #include<iostream> #include <string> using namespace std; string getStudentName(); double getNumberExams(); double getScoresAndCalculateTotal(double E); double calculateAverage(double n, double t); char determineLetterGrade(); void displayAverageGrade(); int main() { string StudentName; double NumberExam, Average, ScoresAndCalculateTotal; char LetterGrade; StudentName = getStudentName(); NumberExam = getNumberExams(); ScoresAndCalculateTotal= getScoresAndCalculateTotal(NumberExam); Average = calculateAverage(NumberExam, ScoresAndCalculateTotal); return 0; } string getStudentName() { string StudentName; cout << "\n\nEnter Student Name:"; getline(cin, StudentName); return StudentName; } double getNumberExams() { double NumberExam; cout << "\n\n Enter...

  • Edit this C++ code to show the output as well. #include<iostream> #include<cstring> using namespace std; class...

    Edit this C++ code to show the output as well. #include<iostream> #include<cstring> using namespace std; class Product { private:    // private variables    int id_number;    char pDescription[40];    int mId;    double productPrice;    double productMarkUp;    int qty; public:    // constructor    Product() {        id_number = 0;        strcpy_s(pDescription, "");        mId = 0;        productPrice = 0.0;        productMarkUp = 0.0;        qty = 0;    }   ...

  • I'm kind of new to programming, and I am having trouble figuring out why my program...

    I'm kind of new to programming, and I am having trouble figuring out why my program isn't running. Below is the code that I wrote for practice. I will comment where it says the error is. So the error that I'm getting is "error: no match for 'operator>>' (operand types are 'std::istream {aka std::basic_istream<char>}' ". I'm not sure why I'm getting this because I added the library <iostream> at the top. Thank you. Code: #include <iostream> using namespace std; class...

  • Using C++ write the following program: 1) For the song program below, on a separate line...

    Using C++ write the following program: 1) For the song program below, on a separate line write a function to quickly print the list of Streaming Services in your Song class, do not modify the program. 2). The Duration in your Song class contains minutes and seconds. Create a data structure called Duration to group the data, do not modify the program but with it on a separate line. #include<iostream> using namespace std; struct Song {    string song_title;   ...

  • Take the following C++ code and add to it the following: Write a program that reads...

    Take the following C++ code and add to it the following: Write a program that reads a string and outputs the number of times each lowercase vowel appears in it. Your program must contain a function with one of its parameters as a char variable, and if the character is a vowel, it increments that vowel's count. #include<iostream> #include<string> using namespace std; int countVowel(char, char); int main(void) { string str1; int countA = 0; int countE = 0; int countI...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT