Question

Rens Courses LMS Integration Documentation SP20 - EE202 - Seco3 - HWS > HW Assignment 6 > & HW6 - Problem 3 - Chapter 6 Probl
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution:

Matlab script is implemented and tested for fnding the sum of n positive integers and all the digits in the sum are equal or not between 100 and 1000.

The following points are considered in the implementation.

1. Script is for entering the positive integer or not.

2. If entered value is not positive integer, program is terminated.

3. Finding the sum of n integers and computed whether the digits are same.

Matlab Script:

% This matlab script is for finding the sum of n integer values
% whether all digits are equal or not between sum values 100 and 1000
clear all;
clc;
%enter the number positive integer only
num = input('enter positive integer only:');
%finding the entered number is positive integer or not
inte_or_not = @(n) (rem(n,1)==0)&(n>0);
res = inte_or_not(num);
if(res == 1)
disp('Entered value is a Positive integer');
sum = 0;
for i=1:num
sum = sum + i;
end
disp('Sum of n integers:');
disp(sum);
%finding all 3 digits are same or not
d = num2str(sum); %separating digits
N = length(d); %finding length
if(N == 3)
if(d(1,1) == d(1,2) && d(1,2) == d(1,3)) %%checking all digits are same or not
disp('The sum value has all same digits:'); %display
disp(sum); % display sum vaues
end
end
else
disp('Entered value is not a Positive integer');
end
%getting the sum of n integers
%%%%%%%%end of program

Results:

enter positive integer only:36
Entered value is a Positive integer
Sum of n integers:
666

The sum value has all same digits:
666

>>

Add a comment
Know the answer?
Add Answer to:
Rens Courses LMS Integration Documentation SP20 - EE202 - Seco3 - HWS > HW Assignment 6...
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
  • MATLAB HW 11 problem using Switch Case and Input commands Write a script file that calculates...

    MATLAB HW 11 problem using Switch Case and Input commands Write a script file that calculates the cost of a movie tickets according to the following price schedule:                                                  Number of Tickets being purchased Time of Movie < =5 tickets 6 to 9 tickets >=10 tickets Afternoon $6 $30 + $5 for the number of tickets above 5 $50 + $4 for the number of tickets above 9 Weeknight $7 $35 + $6 for the number of tickets above 5...

  • ucture.com/courses/6626/assignments/173261 Vritten Assignment 2- Due week 7 Consumer Behavior and Segmentation Assignment Chapter 6 goes through...

    ucture.com/courses/6626/assignments/173261 Vritten Assignment 2- Due week 7 Consumer Behavior and Segmentation Assignment Chapter 6 goes through the decision making process, and Chapter 8 focuses on segmentation and targeting. For this assignment you will focus on a specific decision making process you have gone through 1. Pick a purchase you have made or considered making recently that you would classify has extensive (vs. limited or routinel. 2. Go through the steps you took in the decision making process, and be detailed....

  • MATLAB help! I have some MATLAB Assignment to do, the proffesor requires all the small parts...

    MATLAB help! I have some MATLAB Assignment to do, the proffesor requires all the small parts in order to get full credit. Help me out, thank you f LAB SECTION NAME HW6P3 (30 points) following are infinite series representations of the function, un pra i a script file HW6P3 that determines the value of the function from the sum of the series for a given value of x. The program (1 pt) must prompt the user to enter a value...

  • <Chapter 6 Required HW Assignment Problem 6.83 - Enhanced - with Feedback Calculate the energy change...

    <Chapter 6 Required HW Assignment Problem 6.83 - Enhanced - with Feedback Calculate the energy change (in kilojoules per mole) for the formation of the following substances from their elements. 9 of 12 > Review Constants Periodic Table Part A LiF(s) [The sublimation energy for Li(s) is +159.4 kJ/mol. E; for Li(g) is 520 kJ/mol. E for F(g) is 328 kJ/mol, the bond dissociation energy of F2 (g) is +158 kJ/mol, and the lattice energy of Lif(s) is 1036 kJ/mol]...

  • Assignment 6: Recursion Learning Outcomes • Learn how to craft solutions using recursion instead of loops....

    Assignment 6: Recursion Learning Outcomes • Learn how to craft solutions using recursion instead of loops. Instructions This assignment will be different than previous assignments (and most assignments which come after it). In this assignment, you will be crafting four solutions to four different problems. This assignment will also have special requirements regarding how you may code. You are not allowed to use assignment statements. This includes using preincement, postincrement, predecrement, and postdecrement. You are allowed to use assignment to...

  • COP2221 - Intermediate C++ Programming Module #6 Assignment One 20 points This assignment refers to Learning...

    COP2221 - Intermediate C++ Programming Module #6 Assignment One 20 points This assignment refers to Learning Outcome #2: Create and utilize arrays to store lists of related data Programming Problem You have been hired to create a C++ program to simulate the lottery. Your program allows users to see how often their lottery number choices match a randomly generated set of numbers used to pick lottery winners. The company, "How Lucky Are You?, Inc." wants a modular, professional and user-friendly...

  • please, help me with number 2,3,4,5 and 6. Thank you ARO2041 HW 01 (2) (Protected View)...

    please, help me with number 2,3,4,5 and 6. Thank you ARO2041 HW 01 (2) (Protected View) Word (Unlicensed Product) Mailings Review View Help Tell me what you want to do contain viruses. Unless you need to edit, it's safer to stay in Protected View. Enable Editing n disabled because it hasn't been activated. Activate IIJ YoU are running on the treadmill at he 24 Hour Fitness, and the machine says your speed is 6 mi/hr. You need to run a...

  • ACCT 101 902 Archie Summer 2019 Homework: Chapter 6 Homework Assignment Score: 0 of 1 pt 1 of 1 (0 complete) HW Scor...

    ACCT 101 902 Archie Summer 2019 Homework: Chapter 6 Homework Assignment Score: 0 of 1 pt 1 of 1 (0 complete) HW Score: 06, 0 of 1 P6-28A (similar to) Question Help Fit Gym began October with merchandise inventory of 80 crates of vitamins that cost a total of $3,600 During the mon Fit Gym purchased and sold merchandise on account as follows (Click the icon to view the transactions.) Read the requirements Requirement 1. Prepare a perpetual inventory record,...

  • Save Score: 0 of 3 pts HW Score: 16.67 %, 3 of 18 pts 2 of 6 (2 complete)v Problem 15.9 21 Daniel Glaser, chairman...

    Save Score: 0 of 3 pts HW Score: 16.67 %, 3 of 18 pts 2 of 6 (2 complete)v Problem 15.9 21 Daniel Glaser, chairman of the Colege of San Antonio's business department, needs to assign professors to courses next semester. As a criterion for judging who d should teach each course, Professor Glaser reviews the past 2 years' teaching evaluations (which were filled out by students). Since each of the four professors taught each of the four courses at...

  • IN JAVA PLEASE!!! :) Multithreading can help in achieving parallelism in computational problems. This makes the...

    IN JAVA PLEASE!!! :) Multithreading can help in achieving parallelism in computational problems. This makes the program’s response to generate output faster. It is achieved by delegating independent tasks within the program to separate threads instead of creating a sequential routine. Consider the following sample double array: 3 11 5 19 1 8 4 16 7 18 17 6 3 23 9 If the problem is to display all the row-sums and all the column-sums, a sequential program would use...

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