SlideShare uma empresa Scribd logo
1 de 13
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS
AND PLEASE DON’T SAY GOOD WORK NICE FORMULA
OR SOMETHING LIKE THAT, BUT ACTULLY HE CAN USE.
THANK YOU.
Hartleys Function Code
Contains unread posts
Actions for Hartleys Function Code
Chad Hartley posted Nov 5, 2015 5:10 PM
Subscribe
This program will add an integer number and a decimal number
up to 2 decimal places. I have included notes in the code to
explain what each thing does. I hope I did this right. It compiles
successfully.
PseudoCode
Start
Declare int O1; Stands for Output1
O1=sum; Sum is the functions name
Int sum()
Declare variables
Int num1;
Float num2;
Write “Enter a number.”
Scanf num1
Write”Enter a decimal number.”
Scanf num2
Return num1+num2
end
C Code
#include <stdio.h>
int sum();//prototype
int main()//calling program
{
//Declare a varaiable
int O1;
O1=sum();//main is calling sum one time.
//if I listed this twice it would run the function 'sum'
twice.
// Example: if I add a new int (int O1, O2) and
declare O2 to
//be O2=sum then the function would run twice.
}
int sum ()//function 'sum'
{
int num1;// Declare intergers/variables
float num2;
printf("Enter a number.n");
scanf("%d",&num1);// Take first input and assign it
to num1
printf("Enter a decimal number.n");
scanf("%.2f",&num2);
//Can use the printf statement but when you are
calling an integer you can use the return.
//printf("The sum of %d, %d, is %d",
num1,num2,num1+num2);
return num1+num2;
}
ADD COMMENT HERE
Chaotic Function
Contains unread posts
Actions for Chaotic Function
Joshua Ray posted Nov 5, 2015 2:33 PM
Subscribe
float tmp
int i
function float chaos(float num)
{
for i < 20
num = 3.9*num*(1-num)
print num
}
main
print "Program description"
print "Request input btw 0 and 1"
tmp = input
chaos(tmp)
/*
* File: main.c
* Author: JaiEllRei
*
* Created on November 5, 2015, 2:04 PM
*/
#include <stdio.h>
#include <stdlib.h>
float chaos(float num);
int main(void)
{
float tmp;
printf("This program illustrates a choatic function. n");
printf("Input a number between 0 and 1: ");
scanf("%f", &tmp);
chaos(tmp);
}
float chaos(float num)
{
for (int i=0; i<20; i++){
/*Chaotic Formula*/
num = 3.9 * num * (1-num);
printf("%.3f n", num);
}
}
This program illustrates a choatic function.
Input a number between 0 and 1: .2
0.624
0.915
0.303
0.824
0.566
0.958
0.156
0.514
0.974
0.098
0.345
0.881
0.409
0.943
0.210
0.647
0.891
0.379
0.918
0.293
ADD COMMENT HERE
//MPH to KPH Conversion Function
Function KPHConv(value) as float
Set KPHConv = value*1.609344
End Function
Pseudocode for simple conversion program calling function
//Declare function
// MPH to KPH Conversion Function
Function KPHConv(value) as float
Set KPHConv = inMPH*1.609344
End Function
//Start Main
Main
//Declare variables
Declare inMPH, outKPH as Float
//Initialize variables
inMPH = 1.0f;
outKPH = 0.0f;
Print “Enter a positive value for Miles Per Hour (MPH) or ‘0’ to
exit the program
Input inMPH
//Loop while positive number
While inMPH > 0
//Call the MPH to KPH conversion function
Set outKPH = KPHConv(inMPH)
Print “inMPH miles per hour converts to outKPH kilometers per
hour”
Input next inMPH value
END While
// End of Main program
End program
C Code
#include <stdio.h>
//Week 6 Discussion
//Author: Ken Hartman
//CMIS 102 7380
//Prof. Stephen Grady
//This program will convert a value for Miles Per Hour (MPH)
//to Kilometers Per Hour (KPH)
/* MPH to KPH Conversion Function */
float KPHConv(float value)
{
return value*1.609344;
}
/* Start of Main program */
int main()
{
/* Declare variables to be used as float */
float inMPH;
float outKPH;
/* Initialize the variables needed */
inMPH = 0.0f;
printf("Enter a value for Miles Per Hour (MPH) or 0
to exit the program n");
scanf("%f", &inMPH);
/* Loop while a positive number is entered */
while (inMPH > 0.0)
{
outKPH = KPHConv(inMPH);
printf("n %.2f miles per hour converts to
%.4f kilometers per hourn",inMPH, outKPH);
scanf("%f", &inMPH);
}
return 0;
}
ADD COMMENT HERE!!!!
Joseph Sturdivant posted Nov 6, 2015 11:52 PM
Subscribe
#include <stdio.h>
/* First question output:
* High number = 4
* Low number = 7 [because gettable function receive and
return integer value]
*/
// function which looking for largest number in array
int largest(int array[], int size);
int function(int x) { return x; }
// main function
int main() {
int array[100]; // array where integers will be
stored
int count=0; // how many integers entered
int number; // represent another integer from
input
printf("High = %dn",function(7.8));
printf("Enter integers (0-terminate): n");
do {
scanf("%d",&number); // read one integer
array[count++]=number; // store it into array
} while(number!=0);
// print result of "largest" function
printf("Largest number is %dn",largest(array,count-1));
return 0;
}
int largest(int array[], int size) {
int i;
int max=array[0]; // largest value will be
stored here
for(i=1; i<size; i++) {
if(array[i]>max) max=array[i];
}
return max; // return largest value
}
ADD COMMENT HERE
Thomas Week 6- Solving Functions Discussion
Contains unread posts
Actions for Thomas Week 6- Solving Functions Discussion
Thomas Blass posted Nov 5, 2015 8:08 PM
Subscribe
1. Two arrays are provided, one float array and one integer
array. Functions are used to display the highest number from
the float array and the lowest number from the integer array.
The first function (gettable) will determine the lowest number
from the designated set in the “main” function. Then the second
function (getTable) will determine the highest number from the
designated set in the “main” function. So the expected output
for this pseudocode should be:
“High number= 4
Low number= 7.8”
The only possible error I see here is that there might be an error
with data types. It looks like when the “table1” array is defined
it is of the float data type, but the function pseudocode for
“getTable” is requesting integer data type. I thought that this
might cause an error when the function “getTable” is called
because of different data types.
Has anyone noticed the same or am I incorrect? Professor?
Class?
2. Algorithm and C code posted below! Took me a few tries to
figure out the best approach here.
//Pseudocode
//This program will accept input of positive integers terminated
by 0, then determine
//the largest integer that was entered
//Largest integer function
Declare function largest_number as integer
Declare largest,j as integer
Set j=0
Set largest=user_array element 0
While(j<100000)
If(largest<user_array[j]) then
Set largest=user_array[j]
End if
Increment j
End while
Return largest
End function
Main function
//Declare variables
Declare user_array[100000] as integer
Declare number, i, q, largest as integer
//Initialize the array
for(q=0;q<100000;q++)
user_array[q]=0
//Initialize variables
set i=0
//While loop for array entry
while(i<100000)
print “please enter a positive integer: “
input number
if(number==0) then
break
end if
set user_array[i]=number
increment i
//Print largest number
largest=largest_number(user_array)
print “The largest number is: “
return 0
End program
C code:
//
// main.c
// CMIS102 Solving Functions Discussion
// Created by Thomas Blass on 11/5/15.
#include <stdio.h>
#include <stdlib.h>
//largest integer function
int largest_number(int user_array[])
{
int largest,j;
j=0;
largest=user_array[0];
while(j<100000)
{
if(largest<user_array[j])
{
largest=user_array[j];
}
j++;
}
return largest;
}
int main()
{
//Declare variables
int user_array[100000];
int number,i,q,largest;
//Initialize array
for(q=0;q<100000;q++)
{
user_array[q]=0;
}
//Initialize variables
i=0;
//while loop for array entry
while(i<100000)
{
printf("Please enter a positive number: n");
scanf("%d",&number);
if(number==0)
break;
user_array[i]=number;
i++;
}
//Print largest number
largest=largest_number(user_array);
printf("The largest number is: %dn",largest);
return 0;
}
ADD COMMENT HERE
Vathavadee Smakpunt posted Nov 4, 2015 10:12 PM
Subscribe
Hello all;
1) The output I got is:
High number = 4
Low number =7.8
2) I created function to return maximum number from 3 values.
#include <stdio.h>
//Set getMax function from array
int getMax(int number[])
{
//Declare integer i, max
int i, max;
//Set value for max
max = number [0];
//Set i to zero
i=0;
//Set condition while loop
while (i< 3)
{
scanf("%d", &number[i]);
if(max<number[i])
{
max=number[i];
}
i=i+1;
}
return max;
}
main ()
{
/*Declare number[3], max, and i as integer*/
int number[3], max, i;
/*Set value for max*/
max = getMax(number[0]);
/*Print result*/
printf("Max is =%dn",max);
}
ADD COMMENT HERE

Mais conteúdo relacionado

Semelhante a PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx

Semelhante a PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx (20)

Code optimization
Code optimization Code optimization
Code optimization
 
UNIT3.pptx
UNIT3.pptxUNIT3.pptx
UNIT3.pptx
 
C++ Function
C++ FunctionC++ Function
C++ Function
 
Programming fundamental 02
Programming fundamental 02Programming fundamental 02
Programming fundamental 02
 
Programming egs
Programming egs Programming egs
Programming egs
 
7 functions
7  functions7  functions
7 functions
 
C programming Control Structure.pptx
C programming Control Structure.pptxC programming Control Structure.pptx
C programming Control Structure.pptx
 
Functionincprogram
FunctionincprogramFunctionincprogram
Functionincprogram
 
Function in c
Function in cFunction in c
Function in c
 
An imperative study of c
An imperative study of cAn imperative study of c
An imperative study of c
 
Function in c
Function in cFunction in c
Function in c
 
Functions
FunctionsFunctions
Functions
 
C++ Functions.ppt
C++ Functions.pptC++ Functions.ppt
C++ Functions.ppt
 
C++ code only(Retrieve of Malik D., 2015, p. 742) Programming Exer.pdf
C++ code only(Retrieve of Malik D., 2015, p. 742) Programming Exer.pdfC++ code only(Retrieve of Malik D., 2015, p. 742) Programming Exer.pdf
C++ code only(Retrieve of Malik D., 2015, p. 742) Programming Exer.pdf
 
Dti2143 chapter 5
Dti2143 chapter 5Dti2143 chapter 5
Dti2143 chapter 5
 
The purpose of this C++ programming project is to allow the student .pdf
The purpose of this C++ programming project is to allow the student .pdfThe purpose of this C++ programming project is to allow the student .pdf
The purpose of this C++ programming project is to allow the student .pdf
 
Functions and pointers_unit_4
Functions and pointers_unit_4Functions and pointers_unit_4
Functions and pointers_unit_4
 
Operators1.pptx
Operators1.pptxOperators1.pptx
Operators1.pptx
 
Program flowchart
Program flowchartProgram flowchart
Program flowchart
 
Function in C program
Function in C programFunction in C program
Function in C program
 

Mais de amrit47

APA, The assignment require a contemporary approach addressing Race,.docx
APA, The assignment require a contemporary approach addressing Race,.docxAPA, The assignment require a contemporary approach addressing Race,.docx
APA, The assignment require a contemporary approach addressing Race,.docxamrit47
 
APA style and all questions answered ( no min page requirements) .docx
APA style and all questions answered ( no min page requirements) .docxAPA style and all questions answered ( no min page requirements) .docx
APA style and all questions answered ( no min page requirements) .docxamrit47
 
Apa format1-2 paragraphsreferences It is often said th.docx
Apa format1-2 paragraphsreferences It is often said th.docxApa format1-2 paragraphsreferences It is often said th.docx
Apa format1-2 paragraphsreferences It is often said th.docxamrit47
 
APA format2-3 pages, double-spaced1. Choose a speech to review. It.docx
APA format2-3 pages, double-spaced1. Choose a speech to review. It.docxAPA format2-3 pages, double-spaced1. Choose a speech to review. It.docx
APA format2-3 pages, double-spaced1. Choose a speech to review. It.docxamrit47
 
APA format  httpsapastyle.apa.orghttpsowl.purd.docx
APA format     httpsapastyle.apa.orghttpsowl.purd.docxAPA format     httpsapastyle.apa.orghttpsowl.purd.docx
APA format  httpsapastyle.apa.orghttpsowl.purd.docxamrit47
 
APA format2-3 pages, double-spaced1. Choose a speech to review. .docx
APA format2-3 pages, double-spaced1. Choose a speech to review. .docxAPA format2-3 pages, double-spaced1. Choose a speech to review. .docx
APA format2-3 pages, double-spaced1. Choose a speech to review. .docxamrit47
 
APA Formatting AssignmentUse the information below to create.docx
APA Formatting AssignmentUse the information below to create.docxAPA Formatting AssignmentUse the information below to create.docx
APA Formatting AssignmentUse the information below to create.docxamrit47
 
APA style300 words10 maximum plagiarism  Mrs. Smith was.docx
APA style300 words10 maximum plagiarism  Mrs. Smith was.docxAPA style300 words10 maximum plagiarism  Mrs. Smith was.docx
APA style300 words10 maximum plagiarism  Mrs. Smith was.docxamrit47
 
APA format1. What are the three most important takeawayslessons.docx
APA format1. What are the three most important takeawayslessons.docxAPA format1. What are the three most important takeawayslessons.docx
APA format1. What are the three most important takeawayslessons.docxamrit47
 
APA General Format Summary APA (American Psychological.docx
APA General Format Summary APA (American Psychological.docxAPA General Format Summary APA (American Psychological.docx
APA General Format Summary APA (American Psychological.docxamrit47
 
Appearance When I watched the video of myself, I felt that my b.docx
Appearance When I watched the video of myself, I felt that my b.docxAppearance When I watched the video of myself, I felt that my b.docx
Appearance When I watched the video of myself, I felt that my b.docxamrit47
 
apa format1-2 paragraphsreferencesFor this week’s .docx
apa format1-2 paragraphsreferencesFor this week’s .docxapa format1-2 paragraphsreferencesFor this week’s .docx
apa format1-2 paragraphsreferencesFor this week’s .docxamrit47
 
APA Format, with 2 references for each question and an assignment..docx
APA Format, with 2 references for each question and an assignment..docxAPA Format, with 2 references for each question and an assignment..docx
APA Format, with 2 references for each question and an assignment..docxamrit47
 
APA-formatted 8-10 page research paper which examines the potential .docx
APA-formatted 8-10 page research paper which examines the potential .docxAPA-formatted 8-10 page research paper which examines the potential .docx
APA-formatted 8-10 page research paper which examines the potential .docxamrit47
 
APA    STYLE 1.Define the terms multiple disabilities and .docx
APA    STYLE 1.Define the terms multiple disabilities and .docxAPA    STYLE 1.Define the terms multiple disabilities and .docx
APA    STYLE 1.Define the terms multiple disabilities and .docxamrit47
 
APA STYLE  follow this textbook answer should be summarize for t.docx
APA STYLE  follow this textbook answer should be summarize for t.docxAPA STYLE  follow this textbook answer should be summarize for t.docx
APA STYLE  follow this textbook answer should be summarize for t.docxamrit47
 
APA7Page length 3-4, including Title Page and Reference Pag.docx
APA7Page length 3-4, including Title Page and Reference Pag.docxAPA7Page length 3-4, including Title Page and Reference Pag.docx
APA7Page length 3-4, including Title Page and Reference Pag.docxamrit47
 
APA format, 2 pagesThree general sections 1. an article s.docx
APA format, 2 pagesThree general sections 1. an article s.docxAPA format, 2 pagesThree general sections 1. an article s.docx
APA format, 2 pagesThree general sections 1. an article s.docxamrit47
 
APA Style with minimum of 450 words, with annotations, quotation.docx
APA Style with minimum of 450 words, with annotations, quotation.docxAPA Style with minimum of 450 words, with annotations, quotation.docx
APA Style with minimum of 450 words, with annotations, quotation.docxamrit47
 
APA FORMAT1.  What are the three most important takeawayslesson.docx
APA FORMAT1.  What are the three most important takeawayslesson.docxAPA FORMAT1.  What are the three most important takeawayslesson.docx
APA FORMAT1.  What are the three most important takeawayslesson.docxamrit47
 

Mais de amrit47 (20)

APA, The assignment require a contemporary approach addressing Race,.docx
APA, The assignment require a contemporary approach addressing Race,.docxAPA, The assignment require a contemporary approach addressing Race,.docx
APA, The assignment require a contemporary approach addressing Race,.docx
 
APA style and all questions answered ( no min page requirements) .docx
APA style and all questions answered ( no min page requirements) .docxAPA style and all questions answered ( no min page requirements) .docx
APA style and all questions answered ( no min page requirements) .docx
 
Apa format1-2 paragraphsreferences It is often said th.docx
Apa format1-2 paragraphsreferences It is often said th.docxApa format1-2 paragraphsreferences It is often said th.docx
Apa format1-2 paragraphsreferences It is often said th.docx
 
APA format2-3 pages, double-spaced1. Choose a speech to review. It.docx
APA format2-3 pages, double-spaced1. Choose a speech to review. It.docxAPA format2-3 pages, double-spaced1. Choose a speech to review. It.docx
APA format2-3 pages, double-spaced1. Choose a speech to review. It.docx
 
APA format  httpsapastyle.apa.orghttpsowl.purd.docx
APA format     httpsapastyle.apa.orghttpsowl.purd.docxAPA format     httpsapastyle.apa.orghttpsowl.purd.docx
APA format  httpsapastyle.apa.orghttpsowl.purd.docx
 
APA format2-3 pages, double-spaced1. Choose a speech to review. .docx
APA format2-3 pages, double-spaced1. Choose a speech to review. .docxAPA format2-3 pages, double-spaced1. Choose a speech to review. .docx
APA format2-3 pages, double-spaced1. Choose a speech to review. .docx
 
APA Formatting AssignmentUse the information below to create.docx
APA Formatting AssignmentUse the information below to create.docxAPA Formatting AssignmentUse the information below to create.docx
APA Formatting AssignmentUse the information below to create.docx
 
APA style300 words10 maximum plagiarism  Mrs. Smith was.docx
APA style300 words10 maximum plagiarism  Mrs. Smith was.docxAPA style300 words10 maximum plagiarism  Mrs. Smith was.docx
APA style300 words10 maximum plagiarism  Mrs. Smith was.docx
 
APA format1. What are the three most important takeawayslessons.docx
APA format1. What are the three most important takeawayslessons.docxAPA format1. What are the three most important takeawayslessons.docx
APA format1. What are the three most important takeawayslessons.docx
 
APA General Format Summary APA (American Psychological.docx
APA General Format Summary APA (American Psychological.docxAPA General Format Summary APA (American Psychological.docx
APA General Format Summary APA (American Psychological.docx
 
Appearance When I watched the video of myself, I felt that my b.docx
Appearance When I watched the video of myself, I felt that my b.docxAppearance When I watched the video of myself, I felt that my b.docx
Appearance When I watched the video of myself, I felt that my b.docx
 
apa format1-2 paragraphsreferencesFor this week’s .docx
apa format1-2 paragraphsreferencesFor this week’s .docxapa format1-2 paragraphsreferencesFor this week’s .docx
apa format1-2 paragraphsreferencesFor this week’s .docx
 
APA Format, with 2 references for each question and an assignment..docx
APA Format, with 2 references for each question and an assignment..docxAPA Format, with 2 references for each question and an assignment..docx
APA Format, with 2 references for each question and an assignment..docx
 
APA-formatted 8-10 page research paper which examines the potential .docx
APA-formatted 8-10 page research paper which examines the potential .docxAPA-formatted 8-10 page research paper which examines the potential .docx
APA-formatted 8-10 page research paper which examines the potential .docx
 
APA    STYLE 1.Define the terms multiple disabilities and .docx
APA    STYLE 1.Define the terms multiple disabilities and .docxAPA    STYLE 1.Define the terms multiple disabilities and .docx
APA    STYLE 1.Define the terms multiple disabilities and .docx
 
APA STYLE  follow this textbook answer should be summarize for t.docx
APA STYLE  follow this textbook answer should be summarize for t.docxAPA STYLE  follow this textbook answer should be summarize for t.docx
APA STYLE  follow this textbook answer should be summarize for t.docx
 
APA7Page length 3-4, including Title Page and Reference Pag.docx
APA7Page length 3-4, including Title Page and Reference Pag.docxAPA7Page length 3-4, including Title Page and Reference Pag.docx
APA7Page length 3-4, including Title Page and Reference Pag.docx
 
APA format, 2 pagesThree general sections 1. an article s.docx
APA format, 2 pagesThree general sections 1. an article s.docxAPA format, 2 pagesThree general sections 1. an article s.docx
APA format, 2 pagesThree general sections 1. an article s.docx
 
APA Style with minimum of 450 words, with annotations, quotation.docx
APA Style with minimum of 450 words, with annotations, quotation.docxAPA Style with minimum of 450 words, with annotations, quotation.docx
APA Style with minimum of 450 words, with annotations, quotation.docx
 
APA FORMAT1.  What are the three most important takeawayslesson.docx
APA FORMAT1.  What are the three most important takeawayslesson.docxAPA FORMAT1.  What are the three most important takeawayslesson.docx
APA FORMAT1.  What are the three most important takeawayslesson.docx
 

Último

Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 

Último (20)

Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 

PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx

  • 1. PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY GOOD WORK NICE FORMULA OR SOMETHING LIKE THAT, BUT ACTULLY HE CAN USE. THANK YOU. Hartleys Function Code Contains unread posts Actions for Hartleys Function Code Chad Hartley posted Nov 5, 2015 5:10 PM Subscribe This program will add an integer number and a decimal number up to 2 decimal places. I have included notes in the code to explain what each thing does. I hope I did this right. It compiles successfully. PseudoCode Start Declare int O1; Stands for Output1 O1=sum; Sum is the functions name Int sum() Declare variables Int num1; Float num2; Write “Enter a number.” Scanf num1 Write”Enter a decimal number.” Scanf num2 Return num1+num2 end C Code #include <stdio.h>
  • 2. int sum();//prototype int main()//calling program { //Declare a varaiable int O1; O1=sum();//main is calling sum one time. //if I listed this twice it would run the function 'sum' twice. // Example: if I add a new int (int O1, O2) and declare O2 to //be O2=sum then the function would run twice. } int sum ()//function 'sum' { int num1;// Declare intergers/variables float num2; printf("Enter a number.n"); scanf("%d",&num1);// Take first input and assign it to num1 printf("Enter a decimal number.n"); scanf("%.2f",&num2); //Can use the printf statement but when you are calling an integer you can use the return. //printf("The sum of %d, %d, is %d", num1,num2,num1+num2); return num1+num2; } ADD COMMENT HERE
  • 3. Chaotic Function Contains unread posts Actions for Chaotic Function Joshua Ray posted Nov 5, 2015 2:33 PM Subscribe float tmp int i function float chaos(float num) { for i < 20 num = 3.9*num*(1-num) print num } main print "Program description" print "Request input btw 0 and 1" tmp = input chaos(tmp) /* * File: main.c * Author: JaiEllRei * * Created on November 5, 2015, 2:04 PM */ #include <stdio.h> #include <stdlib.h> float chaos(float num); int main(void) { float tmp;
  • 4. printf("This program illustrates a choatic function. n"); printf("Input a number between 0 and 1: "); scanf("%f", &tmp); chaos(tmp); } float chaos(float num) { for (int i=0; i<20; i++){ /*Chaotic Formula*/ num = 3.9 * num * (1-num); printf("%.3f n", num); } } This program illustrates a choatic function. Input a number between 0 and 1: .2 0.624 0.915 0.303 0.824 0.566 0.958 0.156 0.514 0.974 0.098 0.345 0.881 0.409 0.943 0.210 0.647 0.891 0.379 0.918 0.293
  • 5. ADD COMMENT HERE //MPH to KPH Conversion Function Function KPHConv(value) as float Set KPHConv = value*1.609344 End Function Pseudocode for simple conversion program calling function //Declare function // MPH to KPH Conversion Function Function KPHConv(value) as float Set KPHConv = inMPH*1.609344 End Function //Start Main Main //Declare variables Declare inMPH, outKPH as Float //Initialize variables inMPH = 1.0f; outKPH = 0.0f; Print “Enter a positive value for Miles Per Hour (MPH) or ‘0’ to exit the program Input inMPH //Loop while positive number While inMPH > 0 //Call the MPH to KPH conversion function Set outKPH = KPHConv(inMPH) Print “inMPH miles per hour converts to outKPH kilometers per hour”
  • 6. Input next inMPH value END While // End of Main program End program C Code #include <stdio.h> //Week 6 Discussion //Author: Ken Hartman //CMIS 102 7380 //Prof. Stephen Grady //This program will convert a value for Miles Per Hour (MPH) //to Kilometers Per Hour (KPH) /* MPH to KPH Conversion Function */ float KPHConv(float value) { return value*1.609344; } /* Start of Main program */ int main() { /* Declare variables to be used as float */ float inMPH; float outKPH; /* Initialize the variables needed */ inMPH = 0.0f; printf("Enter a value for Miles Per Hour (MPH) or 0 to exit the program n"); scanf("%f", &inMPH); /* Loop while a positive number is entered */
  • 7. while (inMPH > 0.0) { outKPH = KPHConv(inMPH); printf("n %.2f miles per hour converts to %.4f kilometers per hourn",inMPH, outKPH); scanf("%f", &inMPH); } return 0; } ADD COMMENT HERE!!!! Joseph Sturdivant posted Nov 6, 2015 11:52 PM Subscribe #include <stdio.h> /* First question output: * High number = 4 * Low number = 7 [because gettable function receive and return integer value] */ // function which looking for largest number in array int largest(int array[], int size); int function(int x) { return x; } // main function int main() { int array[100]; // array where integers will be stored int count=0; // how many integers entered int number; // represent another integer from input printf("High = %dn",function(7.8)); printf("Enter integers (0-terminate): n");
  • 8. do { scanf("%d",&number); // read one integer array[count++]=number; // store it into array } while(number!=0); // print result of "largest" function printf("Largest number is %dn",largest(array,count-1)); return 0; } int largest(int array[], int size) { int i; int max=array[0]; // largest value will be stored here for(i=1; i<size; i++) { if(array[i]>max) max=array[i]; } return max; // return largest value } ADD COMMENT HERE Thomas Week 6- Solving Functions Discussion Contains unread posts Actions for Thomas Week 6- Solving Functions Discussion Thomas Blass posted Nov 5, 2015 8:08 PM Subscribe 1. Two arrays are provided, one float array and one integer array. Functions are used to display the highest number from the float array and the lowest number from the integer array.
  • 9. The first function (gettable) will determine the lowest number from the designated set in the “main” function. Then the second function (getTable) will determine the highest number from the designated set in the “main” function. So the expected output for this pseudocode should be: “High number= 4 Low number= 7.8” The only possible error I see here is that there might be an error with data types. It looks like when the “table1” array is defined it is of the float data type, but the function pseudocode for “getTable” is requesting integer data type. I thought that this might cause an error when the function “getTable” is called because of different data types. Has anyone noticed the same or am I incorrect? Professor? Class? 2. Algorithm and C code posted below! Took me a few tries to figure out the best approach here. //Pseudocode //This program will accept input of positive integers terminated by 0, then determine //the largest integer that was entered //Largest integer function Declare function largest_number as integer Declare largest,j as integer Set j=0 Set largest=user_array element 0 While(j<100000) If(largest<user_array[j]) then Set largest=user_array[j] End if Increment j End while Return largest End function Main function
  • 10. //Declare variables Declare user_array[100000] as integer Declare number, i, q, largest as integer //Initialize the array for(q=0;q<100000;q++) user_array[q]=0 //Initialize variables set i=0 //While loop for array entry while(i<100000) print “please enter a positive integer: “ input number if(number==0) then break end if set user_array[i]=number increment i //Print largest number largest=largest_number(user_array) print “The largest number is: “ return 0 End program C code: // // main.c // CMIS102 Solving Functions Discussion // Created by Thomas Blass on 11/5/15. #include <stdio.h> #include <stdlib.h> //largest integer function int largest_number(int user_array[]) { int largest,j; j=0; largest=user_array[0]; while(j<100000)
  • 11. { if(largest<user_array[j]) { largest=user_array[j]; } j++; } return largest; } int main() { //Declare variables int user_array[100000]; int number,i,q,largest; //Initialize array for(q=0;q<100000;q++) { user_array[q]=0; } //Initialize variables i=0; //while loop for array entry while(i<100000) { printf("Please enter a positive number: n"); scanf("%d",&number); if(number==0) break; user_array[i]=number; i++; } //Print largest number largest=largest_number(user_array); printf("The largest number is: %dn",largest); return 0; }
  • 12. ADD COMMENT HERE Vathavadee Smakpunt posted Nov 4, 2015 10:12 PM Subscribe Hello all; 1) The output I got is: High number = 4 Low number =7.8 2) I created function to return maximum number from 3 values. #include <stdio.h> //Set getMax function from array int getMax(int number[]) { //Declare integer i, max int i, max; //Set value for max max = number [0]; //Set i to zero i=0; //Set condition while loop while (i< 3) { scanf("%d", &number[i]); if(max<number[i]) { max=number[i]; } i=i+1; } return max; } main () { /*Declare number[3], max, and i as integer*/ int number[3], max, i;
  • 13. /*Set value for max*/ max = getMax(number[0]); /*Print result*/ printf("Max is =%dn",max); } ADD COMMENT HERE