Create your own unique While-End or (For End) repetition C code. You decide the theme. Be sure to provide an overview of what your repetition structure is doing. Please keep the design simple for this exercise. Just a few lines of code is all that is needed for this response. This should be code you wrote for an application that is interesting to you. In other words, make it your own and have fun with it. Provide the C code and a screen capture showing the results of testing your code in an online compiler. Be sure to test your code with several test cases and show your test case table.
SOURCE CODE:
#include <stdio.h>
#include<stdlib.h>
int main()
{
int i,j,k;
k=1;
while(j!=0)//While loop runs until user enters 0
{
printf("Enter a number to check if prime or not\n");
scanf("%d",&j);//Enter a number to check if number is prime or
not
getchar();
if(j==1)//If number is 1, it is not a prime
{
printf("Not a prime");
break;
}
if(j==2)//If number is 2, it is a prime
{
printf("It is a prime");
break;
}
/*Code to find if number is prime or not*/
for(i=2;i<j;i++)//Run the loop until i becomes number-1
{
if(j%i==0)k=0;//If at any point in the loop, the remainder of i and
the number becomes 0, the value of k changes to 0
}
if(k==1) printf("It is a prime");//If value of k remained
unchanged, print it is a prime
else printf("It is not a prime");//If value of k changed, print not
a prime
}
return 0;
}
SCREENSHOTS:
Create your own unique While-End or (For End) repetition C code. You decide the theme. Be...
Homework 4 – Create your own Function Create your own function in C that accepts one input number and returns a double number. The themes for the functions should be one of the following: Calculates 3.14 times of the square of input number. For example, if 2 is input then 12.56 should be returned. (e.g. 3.14*2*2 = 12.56) Divides the number by 3 and returns the result. For example, if 6 was input then 2.0 should be returned....
Application Exercises – 1.15“Personal Mission Statement and
Code of Conduct”
Introduce yourself to the class by articulating your own
personal statement. Do a bit of research first (as the textbook
suggests). Then, in your initial DB post write a few sentences to
introduce yourself and to mention the sources or examples you
relied on to compose your personal mission statement and code of
conduct. Then, attach your document.
Application Exercis 1.15 Personal Mission Statement and Code of Conduct (LO 1.3)...
You decide to take advantage of the current online dating craze and start your own Web site. You know that you have 450 people who will sign up immediately and, through a careful marketing research and analysis, determine that membership can grow by 27 percent in the first two years, 22 percent in year 3, and 18 percent in Year 4. How many members do you expect to have at the end of four years? (Round intermediate calculations to 6...
You decide to take advantage of the current online dating craze and start your own Web site. You know that you have 550 people who will sign up immediately and, through a careful marketing research and analysis, determine that membership can grow by 29 percent in the first two years, 22 percent in year 3, and 18 percent in Year 4. How many members do you expect to have at the end of four years? (Round intermediate calculations to 6...
You want to celebrate all of your recent successes. You decide to reward yourself and a special someone with a vacation to a destination of your choosing. For your trip you will need to stay in a hotel/resort and rent a car. You decide to rent a car for the duration of your trip. You have two options. Write an equation for each company that depicts the total cost of the rental, y, based on the number of days, x....
You want to celebrate all of your recent successes. You decide to reward yourself and a special someone with a vacation to a destination of your choosing. For your trip you will need to stay in a hotel/resort and rent a car. You decide to rent a car for the duration of your trip. You have two options. Write an equation for each company that depicts the total cost of the rental, y, based on the number of days, x....
Problem 5.19 (Excel Video) You decide to take advantage of the current online dating craze and start your own Web site. You know that you have 400 people who will sign up immediately and, through a careful marketing research and analysis, determine that membership can grow by 29 percent in the first two years, 20 percent in year 3, and 18 percent in Year 4. How many members do you expect to have at the end of four years? (Round...
In basic C please with comments so I can redo It on my own, thank you! For this lab, you only need to write a single user-defined function that analyzes a 2D array of chars. You do NOT need to write any of the code in main() that calls your function. Make sure to use the template and only add code to the user-defined function. Write a function win() with the following definition (i.e. prototype): int win(char board[7][5], char player)...
For this assignment you will be creating a multi-file project in which you implement your own templated linked list and use it to create a simple list of composers. When doing this assignment, take small, incremental steps; trying to complete the lab in one go will make the lab more difficult. This means that any time you finish part of the lab, such as a linked list method, you should immediately test and debug it if necessary. Part 1: Creating...
Hi! it is c++ queue simulation please read the instructions, write codes, and explain the code with comments. Thank you Transactions enter the system and are stored in a queue. Each transaction represents some work that needs to be accomplished. Servers exist which process transactions. Servers take transactions off the queue and process them. you’re building the simulation framework. The idea is that somebody would take your framework, and add the specifics for whatever type of system it was going...