Here we use int * ptr; to declare a pointer and store address of a variable in it;
#include <stdio.h>
int main(void) {
int * ptr1,*ptr2;
int i=20,product=1;
ptr1=&i; //ptr1 refers to variable i=20 which is
the lower limit for mux
ptr2=&product; //ptr2 refers to variable product
which will find the answer of //product of all even numbers from 20
to 30
//*ptr1=20,*ptr2=1
while(*ptr1<=30)
{
*ptr2=(*ptr2)*(*ptr1); //we multiply value from 20 to
product=1 and add 2 to multiply all //even numbers till 30
*ptr1=*ptr1+2;
}
printf("%d\n",product);
return 0;
}
#include <stdio.h>
int main(void) {
int * ptr1,*ptr2;
int i=20,product=1;
ptr1=&i;
while(*ptr1<=30)
{
product=product*(*ptr1);
*ptr1=*ptr1+2;
}
printf("%d\n",product);
return 0;
}
3.Use two pointers ptr1 and ptr2 to display the product of the even numbers between 20...
1) (5 points) The following program is used to display numbers between two intervals include stdio.h define true 1 define false 0 5 void prime (int low, int high) int i -o, flag-0 ; printf ("Prime numbers between %d and %d are: ", low, high); while (low <high) 10 flag false; 12 13 for (i 0; i <-low/2; ++i) - 15 16 17 if(low % ?--0) flagtrue: break; 19 20 21 if (flagtrue ) 23 24 25 26 27 28...
I want to create the flags for Poland, the Netherlands, and Italy using ppm files and file redirection. I can't seem to get my pixels lined up correctly to make my flags. Here's my output for when I tried to make my flag for Poland. Any way to fix this? I am working in C #include #include <stdio.h> <stdlib.h> void make_pixel (int r, int g, int b); void make-ppm-header (int width, int height); void make_ppm_image (int country_code, int width) int...
Solve using C programming 3. lf you are given this code. #include <stdio.h> int main() int var1, var2; int sum; printf("Enter number 1:\n "); scanf("%d",&var1); printf("Enter number 2:In ); scanf("%d",&var2); sum-var1+var2; printf ("Vnsum of two entered numbers : %d", //printf ("Output: %d", res); sum); return e; Modify this code by creating a function called "addition". Make the arguments of the functions numberl and number 2. Add the two values in the function. Return a value called "result". Print "result" in...
What's wrong with my code? : I'm trying to use recursive functions to display and count all the even numbers of an array. However, I can't seem get the program output the number of even integers . Here's the output I want: Here are the 5 even numbers: // Luckily, however, my code does output all the even numbers. But, I also want the program to tell me how may even integers there are. 2 8 14 18 22 MY...
Write a program that check odd / even numbers (from number 1 to 100). Display the results within an HTML table with 2 columns: one for odd number and one for even numbers. NUMBERS RESULTS ODD EVEN ODD 2 HINT: use <table> tags to create a table, <th> tags for 'Numbers' and 'Results'. Wrap code PHP inside HTML code. For example: <html> <title>CHECK ODD or EVEN</title> <body> <table> ?php echo "<tr><td>l</td><td>Odd</td</tr>"; </table> </body </html 2. Do the following steps in...
using C++ l Grant P. Microsoft PowerPoi.. Mail - elijah joshlin.. Tokyo Ghoul 3 (Sub.. How to Watch The... OS EJ Purpose The purpose of this lab is to learn how to use pointers within an application. Process Use the following main function: include <stdio.h> void main int i; int j: int p i 10 5 20: Add printf statements to display the values assigned to each variable and their addresses. Your output should appear similar to the following: i:...
Use a for loop to print out the string with spaces in between each letter code.cpp New 1 #include iostream> 2 #include <string> 4 using namespace std; 5 //Use a for loop to print out the string with spaces in between each letter int main() 7 string str "Hello World"; 葌 9
I JUST NEED HELP WITH DISPLAY PART! please help! thanks in advance // This function saves the array of structures to file. It is already implemented for you. // You should understand how this code works so that you know how to use it for future assignments. void save(char* fileName) { FILE* file; int i; file = fopen(fileName, "wb"); fwrite(&count, sizeof(count), 1, file); for (i = 0; i < count; i++) { fwrite(list[i].name, sizeof(list[i].name), 1, file); fwrite(list[i].class_standing, sizeof(list[i].class_standing), 1, file);...
Make a program that will calculate and compute for the quotient of miles and gallons (mpg: miles per gallons). Your program should must ask the user to specify the size of the array (using dynamic array) for the following variable: miles ,gallons and mpg. Prompt the user to Initialize the value of miles (value for miles should be 100-250) and gallons (values should be from 5-25). Use pointer galPtr for gallons, milPtr for miles and mpgPtr for mpg. Use function...
above in the image is a linked list with 2 nodes. You can use this or write a similar one. The assignment is to write 2 functions. One function will add another node at the end of the list. The other function will delete a node. Don't forget - No dangling pointers C++ language Make sure its corect and runs without errors and I promise to give you a thumbs up. #include iostream» using namespace std; class Node int data;...