C programming Question (Please help if you can)
- Create a "loop" that will execute n times, displaying numbers starting at b and incrementing by i. The numbers that would result should be inserted into an array
for example
n = 5
b = 6
i = 4
resulting array= {6 10 14 18 22}
--------------------------------
n = 6
b = 10
i = 3
resulting array = {10 13 16 19 22 25}
ANSWER: Here I am giving you the code and output before downvote kindly comment on your problem or like it, please.
CODE:
#include <stdio.h>
int main()
{
int n,b,i,j;
printf("n= ");
scanf("%d",&n);
printf("b= ");
scanf("%d",&b);
printf("i= ");
scanf("%d",&i);
int arr[n],m=n,k;
for(j=0;j<n;j++){
if(j==0)
arr[j]=b;// for first element it should be b
else{
arr[j]=arr[j-1]+i; // and next values will be previous + value of
i
}
}
printf("resulting array = ");
for(k=0;k<m;k++){
printf("%d ",arr[k]);
}
return 0;
}
OUTPUT:

C programming Question (Please help if you can) - Create a "loop" that will execute n...
Please complete the following programming in C++ with clear explanations. Thanks! Primitive Types, Searching and Recursion a) Create a class Homework (in a file homework.h and homework.cpp). b) Create a function initialize_array that receives two parameters: an array of integers and the array size. Use a for loop and an if statement to put 1s in the odd positions of the array and 0s in the even positions. (Use pointers to pass an array of integers as parameter) c) Create...
Assembly Language Programming Assignment program must be in: MASM assembly language / x86 architecture / irvine library procedures Objectives: 1. using register indirect addressing 2. passing parameters 3. generating “random” numbers 4. working with arrays Description: Write and test a MASM program to perform the following tasks: 1. Introduce the program. 2. Generate ARRAYSIZE random integers in the range [LO = 10 .. HI = 29], storing them in consecutive elements of an array. ARRAYSIZE should be set to 200....
5.4 Java Create a program that generates SuperLotto lottery numbers. Create a class called SuperLottoPlus.java Create a method called generateSuperLottoNumbers() that returns an array of 6 random SuperLotto lottery numbers. The first 5 numbers must be from the range 1 to 47 The 6th number (the MEGA) must be from 1 to 27. Create a method called printTicket() that takes an integer array as an parameter it will loop through the integer array and print out the data Display the...
Use C programming,
Also please use “printf” function when displaying text
In Probability, number of"combinations" (sometimes referred to as binomial coefficients) ofn times taken r at a time is written as C (n.r) = | | = . If an order conscious subset of r times taken from a set of n times- the permutations, it is written as P(n, r) = . Both cases, r n 1. n! r r(nr)! n! Create a script that will prompt the user...
C# 1. Given two lengths between 0 and 9, create an rowLength by colLength matrix with each element representing its column and row value, starting from 1. So the element at the first column and the first row will be 11. If either length is out of the range, simply return a null. For exmaple, if colLength = 5 and rowLength = 4, you will see: 11 12 13 14 15 21 22 23 24 25 31 32 33 34...
Python programming: Write a while loop that prints a. All squares less than n. For example, if n is 100, print 0 1 4 9 16 25 36 49 64 81. b. All positive numbers that are divisible by 10 and less than n. For example, if n is 100, print 10 20 30 40 50 60 70 80 90 c. All powers of two less than n. For example, if n is 100, print 1 2 4 8 16...
java: 1d arrays PLEASE NEED HELp THANK YOU!!! One dimensional (1D) array 1. Create an array of 1000 integers. Name the array: x 2. Assign 95 to the ninth element, 25 to the twentieth element of array x. 3. Assign the sum of the ninth and the twentieth element to the sixtieth element of array x. 4. Display the sixtieth element of the array. 5. Use the for statement to generate all indexes to read and display all elements in...
In this lab you will convert lab5.py to use object oriented
programming techniques. The createList and checkList functions in
lab5.py become methods of the MagicList class, and the main
function of lab6.py calls methods of the MagicList class to let the
user play the guessing game.
A. (4pts) Use IDLE to create a lab6.py. Change the 2 comment
lines at the top of lab6.py file:
First line: your full name
Second line: a short description of what the program...
Programming in java
In this part of this Lab exercise, you will need to create a new class named ArrayShiftMult. This class carries out simple manipulation of an array. Then you should add a main method to this class to check that your code does what it is supposed to do. 1. Create a BlueJ project named LAB06 as follows: a. Open the P drive and create a folder named Blue), if it does not exist already. Under this folder,...
I posted this question earlier but realized that the code was not easy to test since it was just screenshots and not text so I am reposting it: I'm very new at working with file streams, and I'm having trouble with a HW assignment I have to work on. For the assignment I have to read an input file named "MagicSquaresIn.txt" (included at the bottom) and I have to check whether they are normal, associative, and panmagic. To check that...