Write a program that inputs a number between 1 and 10 and displays the number with the appropriate two-letter ending (e.g., 1st, 2nd, 3rd, 4th, 5th, . . . ). Using Visual Logic
Hello Reader,
The question is to display the number with it's subscript, for this we must note that from one to 10 - only 1 , 2 , 3 have different subscript else all have same subscript 'th'.
We approach the question by taking the input as 'i' then for safety we assign a new variable t=i, and then checking starts:
if i=1, then (t-1) will be 0 so add "st" at the end
else if i=2, then (t-2) will be 0 so add "nd" at the end
else if i=3, then (t-3) will be 0 so add "rd" at the end
now comes the general case if i>3 then (t-3) will not be 0, (t-2) will not be 0, (t-1) will not be 0 -- so add a "th" at the end
The following image depicts the logic explained above:
Hope it helps!! Any queries are welcomed.
Write a program that inputs a number between 1 and 10 and displays the number with...
using C programming Date Write a program that reads a month and a day in that month and prints the date in format "month day". The input is two integers, one between 1 and 12 (inclusive) and one between 1 and 31 (inclusive) and the output is a single line in format "month day". For example, for input 2 10 the program will print "February 10th". The day will always have the ordinal indicator, e.g. 1st, 2nd, 3rd, 4th. Example...
Please answer using written program in C language!! :) Part 2: (10 marks) voltFourierSqWave Function Fourier Analysis is used to break down a complex periodic waveform into its fundamental frequency and harmonics of the fundamental. The harmonics are frequencies that are whole number multiples of the fundamental frequency. For a squarewave only the odd harmonics are considered. For example, for a 1kHz squarewave, the 1ST Harmonic is 1kHz, 3RD Harmonic is 3kHz, 5TH Harmonic is 5kHz, etc. The voltage at...
Write a program that displays a menu on the screen. The menu will give the user four options - enter two integers, enter two decimal numbers (#.#), enter one integer and one decimal number, or quit. The inputs should be labelled a, b, c, or d, and you should enter in the letter to choose the appropriate option. Once the user selects the option, two numbers will be read in from the user. The numbers will be added together and...
Write a C program using array(s) that inputs 20 real numbers, then displays it backward on the screen. Print the given array and backward array.
In C++ using For Loops; "Write a program that displays number facts for a number provided by the end user between 1-100 in a table format that includes the number itself, whether the number is a prime number, whether the number is even or odd, whether the number is a perfect square and all of its factors. " It should also print this information.
Debug Assembly Programs 1). Write a C program that displays the letters of the alphabet in reverse order, omitting the vowels. Do not write this program using any data allocation statements. 2). Write a program that computes and display the 1st 20 numbers in the Fibonacci series.
Problem 1: Write a program that reads a positive float number and displays the previous and next integers. Sample Run: Enter a float: 3.5 The previous and next integers are 3 and 4. Problem 2: Write a program that reads two integers and displays their sum, difference, product, and the result of their division. Sample Run: Enter two integers: 8 5 Sum: 8, Difference: 3, Product: 40, Division: 1.6 Problem 3: Write a program that reads a three-digit integer from...
(Printing Series) Write a program that displays numbers for a given number, n to 1 using for statement.
30. Create a program that will create a "number battle" between two users. Ask each user to enter three numbers that sum to a maximum of 30. Then the program will compare each users 1st, 2nd and 3rd number and determine who won each battle. For instance if user A enters 18,11,1 and user B enters 6,17,7 then user B would win because they won 2 of 3 battles. Have a check to see if the sum to 30 rule...
FOR RUBY: ----------------------------------- Create a program named Gifts. This program will describe the gifts for the 12 Days of Christmas. Each day describes one gift only. You cannot explicitly output the list of gifts, you need to get each day to display. For instance, for the 3rd day of Christmas, you display the gift for the 3rd day, then display the gift for the 2nd day, then the gift for the 1st day. Think about the logic for this.. in...