Preview

The Last Ride Together

Good Essays
Open Document
Open Document
666 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
The Last Ride Together
Question 1: Write a program to input a start limit S (S>0) and the last limit L (L>0). Print all the prime triplets between S and L (both inclusive), if S<=L otherwise your program should ask to re-enter the values of S and L again with a suitable error message.

Algorithm: * Start * To input the lower limit * To input the upper limit * To run the outer loop * To run inner loop * To calculate total number of prime numbers between lower and upper limits * To declare array with it’s number of elements as ‘s’ * To run the outer loop * To run the inner loop * To store the prime numbers in array a[] * To run a loop for every position of array a[] * If condition matches for the number for prime triplets * Continue till all Prime Triplets are printed

Question 2: A unique digit integer is a positive integer (without leading zeros) with no duplicate digits. For example 7, 135, 214 are all unique digit integers whereas 33, 3121, 300 are not. Given two positive integers m and n, where m<n, write a program to determine how many unique digit integers are there in the range between m and n (both inclusive) and output them.

Algorithm: * Start * To input the starting limit * To input the last limit * To run the outer loop * To store the value of ‘i’ as a string * To run the inner loop * To run a nested loop of the inner loop * To check for repetition of any digit in the number * To store all the unique digit integers in a string * To store the frequency of unique digit integers * To print the unique digit integers and their frequency

Question 3: Write a program which inputs Natural numbers N and M followed by integer arrays A[ ] and B[ ], each consisting of N and M numbers of elements respectively. Sort the arrays A[ ] and B[ ] in Ascending order of magnitude. Use the sorted arrays A[ ]

You May Also Find These Documents Helpful

  • Satisfactory Essays

    cout << num1 << " - " << num2 << " = " << num1-num2;…

    • 426 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Nt1420 Unit 6

    • 1145 Words
    • 5 Pages

    INSTRUCTIONS: 1. THERE ARE SIX (6) QUESTIONS IN THIS PAPER. 2. ANSWER FIVE (5) QUESTIONS ONLY. Question 1 Arrays are used when storing a large number of values. You are required to create an array named a and answer the following questions regarding array manipulation. a. Write a method fillRandom(int[] a, int min, int max), fill the array a with a random integer value. (Note: Math.random() returns a double in the range of 0.0 and 1.0, therefore it is cast to an integer number, between the minimum and maximum value). [6 marks] b. Write the Bubble sort method to sort array a into descending order. [10 marks] c. In the quicksort, an algorithm an element is chosen from the unsorted list. This element is called the…

    • 1145 Words
    • 5 Pages
    Good Essays
  • Good Essays

    Nt1310 Unit 3 Lab Report

    • 880 Words
    • 4 Pages

    This POW is all about finding information and patterns about the way divisors of certain numbers are found and expressed. In this POW when we talk about divisors we usually are counting the number of divisors that a number has. The divisor is a number that a number can be divided by, of course every number is divisible by every other number but in these problems we are only talking about whole, positive numbers. Every number is divisible evenly by one or itself so every number has at least 2 divisors. Numbers that have only 2 divisors are called prime numbers, only uneven numbers can be prime numbers, all even numbers except two have at least 3 divisors, the number itself, 1 and 2.…

    • 880 Words
    • 4 Pages
    Good Essays
  • Satisfactory Essays

    Pt1420 Unit 7 Study Guide

    • 582 Words
    • 3 Pages

    22.Write a program to read a sequence of characters and display them in reverse order on the next line. Page: 144…

    • 582 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Problem Statement: The POW starts off with the random 3-digit number 473 and number the problem says to arrange the digits from largest to smallest, which is 743. Then arrange the digits from smallest to largest, which is 347. The arrangement of the digits from least to greatest is subtracted from the arrangement of those same digits from greatest to least. The problem we ultimately end up doing is 473-347 and the difference is 396. The problem asks the students to continue the process of choosing a number, arranging its digits so the lowest arrangement of the digits is subtracted from the highest arrangement of the digits. The problem also asks the readers to test out the steps using 3, 4, 5, 6 and so forth and explain what they discover.…

    • 412 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    c. Modify the program of Part b so that at the option of the user, it displays…

    • 300 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    Simpsons

    • 982 Words
    • 4 Pages

    1. Rearrange these numbers in order of size, starting with the smallest and ending with the largest, in both digit form and in words. • • • • 5 078 231 5 807 123 587 321 5 780 321 Number (in Digits)…

    • 982 Words
    • 4 Pages
    Satisfactory Essays
  • Powerful Essays

    It 210

    • 2960 Words
    • 12 Pages

    After reading this chapter, you will be able to do the following: Declare and use one-dimensional arrays [Section 6.1] Manipulate parallel arrays [Section 6.1] Use the serial search technique to search an array for a specified element [Section 6.2] Use the bubble sort technique to sort an array into a specified order [Section 6.2] Use the binary search procedure for locating an item in an array [Section 6.3] Use the selection sort procedure for sorting an array [Section 6.3] Represent character strings as arrays [Section 6.4] Declare and use two-dimensional arrays [Section 6.5]…

    • 2960 Words
    • 12 Pages
    Powerful Essays
  • Good Essays

    In my mind I made a number line and crossed off every even number, then the odds divisible by three, five, seven and nine (except themselves), and, of course, one. Looking for twin primes, I located 17 and 19, 11 and 13, as well the triplet three, five and seven, which I divided into two twin primes.…

    • 537 Words
    • 3 Pages
    Good Essays
  • Good Essays

    The Movie Crash

    • 902 Words
    • 4 Pages

    The most powerful scene in this movie is when the Indian man shows up at the end the Spanish mans house still upset his store getting robbed and blaming him for it. The Indian man has a fully loaded revolver. When the Spanish man get out of his work truck, the Indian man walks up and pulls out his gun asking him where his money was. The Spanish man not knowing what he was talking about he went in his pocket and told him he could have the fifty dollars that he had. At the same time all this builds up the Spanish mans daughter is in the houses front doorway looking at he father. The Spanish man had a bond with his daughter about a special gift that they had to wear and she realized that her father was not wearing it. His daughter ran…

    • 902 Words
    • 4 Pages
    Good Essays
  • Satisfactory Essays

    Joyride

    • 420 Words
    • 2 Pages

    In the book Joyride by Anna Banks, the setting of the book is a high school mainly. Most of the action in the book takes place at the high school. The book doesn’t say when it takes place, but i feel like it takes place in the early 2000’s. I feel that the author picked this as a setting because a high school is where a lot of your time is spent as a teenager, and more than likely where you’re gonna meet a lot of people.…

    • 420 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    This spring I spent two-weeks in New York visiting my daughter and her family. I spend a lot of time in the city, and I love it, not only because my daughter has chosen to create and raise a family in Brooklyn, but also because of its walkability. I’m not much of a shopper, but I do like to watch other shoppers, particularly those who dress as if they’d like to be watched.…

    • 1185 Words
    • 5 Pages
    Powerful Essays
  • Good Essays

    Motorcycle Diaries

    • 679 Words
    • 3 Pages

    In Motorcycle Diaries by Ernesto “Che” Guevara, the jaunty bikers turn into benevolent bystanders of mankind along the direction of this pilgrimage, thus bringing the determination of the adventure to completion, at least in hindsight. The ardor and the benevolence shine through the whole text and an inexperienced aspiration galvanizes it, and that is a part of its continuing allure. What is to be said, it is the setting of the story that the readers are capable of observing the metamorphosis of young Ernesto, which can be seen in Ernesto’s writing when he finishes the whole journey, in Valparaiso when he sees a poor woman, and in Antofagasta when he is a stowaway.…

    • 679 Words
    • 3 Pages
    Good Essays
  • Good Essays

    The Movie Crash

    • 1400 Words
    • 6 Pages

    The film "Crash" written and directed by Paul Haggis was taken place in Los Angeles. This movie illustrates how discrimination and prejudice has affected our everyday lives, due to the misconceptions we have of each other. All the characters in this movie are either victims of prejudice and discrimination or are guilty of it. To help us give more understanding about this movie I am comparing the movie Crash to Joseph Healey textbook, Race, Ethnicity, Gender & Class.…

    • 1400 Words
    • 6 Pages
    Good Essays
  • Satisfactory Essays

    3) Design an algorithm that does the following: Opens an output file with the external name number_list.dat, uses a loop to write the numbers 1 through 100 to the file and then closes the file.…

    • 544 Words
    • 4 Pages
    Satisfactory Essays