SlideShare a Scribd company logo
Hi,
I have updated the code. It is workin fine as expected. Highlighted the code changes below.
#include
int main(void) {
int totalVal = 0;
int userInt = 0;
int temp = 0;
// FIXME: Ask user to input an integer, store in userInt
printf("Enter an integer: ");
scanf("%d", &userInt);
temp = userInt;
totalVal = userInt;
// FIXME: Add while loop that counts down to 1, updating totalVal
while(userInt != 1){
userInt--;
totalVal = totalVal * userInt;
}
userInt = temp;
printf("%d! is %d ", userInt, totalVal);
return 0;
}
Output:
Enter an integer:
5
5! is 120
Solution
Hi,
I have updated the code. It is workin fine as expected. Highlighted the code changes below.
#include
int main(void) {
int totalVal = 0;
int userInt = 0;
int temp = 0;
// FIXME: Ask user to input an integer, store in userInt
printf("Enter an integer: ");
scanf("%d", &userInt);
temp = userInt;
totalVal = userInt;
// FIXME: Add while loop that counts down to 1, updating totalVal
while(userInt != 1){
userInt--;
totalVal = totalVal * userInt;
}
userInt = temp;
printf("%d! is %d ", userInt, totalVal);
return 0;
}
Output:
Enter an integer:
5
5! is 120

More Related Content

Similar to Hi,I have updated the code. It is workin fine as expected. Highlig.pdf

Java căn bản - Chapter6
Java căn bản - Chapter6Java căn bản - Chapter6
Java căn bản - Chapter6Vince Vo
 
Dti2143 lab sheet 9
Dti2143 lab sheet 9Dti2143 lab sheet 9
Dti2143 lab sheet 9alish sha
 
The following code is an implementation of the producer consumer pro.pdf
The following code is an implementation of the producer consumer pro.pdfThe following code is an implementation of the producer consumer pro.pdf
The following code is an implementation of the producer consumer pro.pdf
marketing413921
 
Programming in C
Programming in CProgramming in C
Programming in C
Nishant Munjal
 
Bottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docxBottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docx
AASTHA76
 
UNIT-II CP DOC.docx
UNIT-II CP DOC.docxUNIT-II CP DOC.docx
UNIT-II CP DOC.docx
JavvajiVenkat
 
Cinfo
CinfoCinfo
Cinfo
teach4uin
 
Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10alish sha
 
Programming fundamental 02
Programming fundamental 02Programming fundamental 02
Programming fundamental 02
Suhail Akraam
 
In C Programming create a program that converts a number from decimal.docx
In C Programming create a program that converts a number from decimal.docxIn C Programming create a program that converts a number from decimal.docx
In C Programming create a program that converts a number from decimal.docx
tristans3
 
Programming Global variable
Programming Global variableProgramming Global variable
Programming Global variable
imtiazalijoono
 
C code This program will calculate the sum of 10 positive .docx
 C code This program will calculate the sum of 10 positive .docx C code This program will calculate the sum of 10 positive .docx
C code This program will calculate the sum of 10 positive .docx
aryan532920
 
C decision making and looping.
C decision making and looping.C decision making and looping.
C decision making and looping.
Haard Shah
 
Core programming in c
Core programming in cCore programming in c
Core programming in c
Rahul Pandit
 
Oop object oriented programing topics
Oop object oriented programing topicsOop object oriented programing topics
Oop object oriented programing topics
(•̮̮̃•̃) Prince Do Not Work
 
I need help to modify my code according to the instructions- Modify th.pdf
I need help to modify my code according to the instructions- Modify th.pdfI need help to modify my code according to the instructions- Modify th.pdf
I need help to modify my code according to the instructions- Modify th.pdf
pnaran46
 
Composing an App with Free Monads (using Cats)
Composing an App with Free Monads (using Cats)Composing an App with Free Monads (using Cats)
Composing an App with Free Monads (using Cats)
Hermann Hueck
 
Lab #5_Revised  (Due 121315)This is a revision on the previous.docx
Lab #5_Revised  (Due 121315)This is a revision on the previous.docxLab #5_Revised  (Due 121315)This is a revision on the previous.docx
Lab #5_Revised  (Due 121315)This is a revision on the previous.docx
VinaOconner450
 
C notes diploma-ee-3rd-sem
C notes diploma-ee-3rd-semC notes diploma-ee-3rd-sem
C notes diploma-ee-3rd-sem
Kavita Dagar
 
Find attached the code to implement the following two functions- 1- In.pdf
Find attached the code to implement the following two functions- 1- In.pdfFind attached the code to implement the following two functions- 1- In.pdf
Find attached the code to implement the following two functions- 1- In.pdf
JustinamEOgdend
 

Similar to Hi,I have updated the code. It is workin fine as expected. Highlig.pdf (20)

Java căn bản - Chapter6
Java căn bản - Chapter6Java căn bản - Chapter6
Java căn bản - Chapter6
 
Dti2143 lab sheet 9
Dti2143 lab sheet 9Dti2143 lab sheet 9
Dti2143 lab sheet 9
 
The following code is an implementation of the producer consumer pro.pdf
The following code is an implementation of the producer consumer pro.pdfThe following code is an implementation of the producer consumer pro.pdf
The following code is an implementation of the producer consumer pro.pdf
 
Programming in C
Programming in CProgramming in C
Programming in C
 
Bottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docxBottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docx
 
UNIT-II CP DOC.docx
UNIT-II CP DOC.docxUNIT-II CP DOC.docx
UNIT-II CP DOC.docx
 
Cinfo
CinfoCinfo
Cinfo
 
Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10
 
Programming fundamental 02
Programming fundamental 02Programming fundamental 02
Programming fundamental 02
 
In C Programming create a program that converts a number from decimal.docx
In C Programming create a program that converts a number from decimal.docxIn C Programming create a program that converts a number from decimal.docx
In C Programming create a program that converts a number from decimal.docx
 
Programming Global variable
Programming Global variableProgramming Global variable
Programming Global variable
 
C code This program will calculate the sum of 10 positive .docx
 C code This program will calculate the sum of 10 positive .docx C code This program will calculate the sum of 10 positive .docx
C code This program will calculate the sum of 10 positive .docx
 
C decision making and looping.
C decision making and looping.C decision making and looping.
C decision making and looping.
 
Core programming in c
Core programming in cCore programming in c
Core programming in c
 
Oop object oriented programing topics
Oop object oriented programing topicsOop object oriented programing topics
Oop object oriented programing topics
 
I need help to modify my code according to the instructions- Modify th.pdf
I need help to modify my code according to the instructions- Modify th.pdfI need help to modify my code according to the instructions- Modify th.pdf
I need help to modify my code according to the instructions- Modify th.pdf
 
Composing an App with Free Monads (using Cats)
Composing an App with Free Monads (using Cats)Composing an App with Free Monads (using Cats)
Composing an App with Free Monads (using Cats)
 
Lab #5_Revised  (Due 121315)This is a revision on the previous.docx
Lab #5_Revised  (Due 121315)This is a revision on the previous.docxLab #5_Revised  (Due 121315)This is a revision on the previous.docx
Lab #5_Revised  (Due 121315)This is a revision on the previous.docx
 
C notes diploma-ee-3rd-sem
C notes diploma-ee-3rd-semC notes diploma-ee-3rd-sem
C notes diploma-ee-3rd-sem
 
Find attached the code to implement the following two functions- 1- In.pdf
Find attached the code to implement the following two functions- 1- In.pdfFind attached the code to implement the following two functions- 1- In.pdf
Find attached the code to implement the following two functions- 1- In.pdf
 

More from ankitcom

using the equation P1V1T1 = P2V2T2 we have .pdf
                     using the equation P1V1T1 = P2V2T2  we have  .pdf                     using the equation P1V1T1 = P2V2T2  we have  .pdf
using the equation P1V1T1 = P2V2T2 we have .pdf
ankitcom
 
Yes, theyre right. .pdf
                     Yes, theyre right.                             .pdf                     Yes, theyre right.                             .pdf
Yes, theyre right. .pdf
ankitcom
 
we do not have rights to delete questionsSolutionwe do not hav.pdf
we do not have rights to delete questionsSolutionwe do not hav.pdfwe do not have rights to delete questionsSolutionwe do not hav.pdf
we do not have rights to delete questionsSolutionwe do not hav.pdf
ankitcom
 
The most iteresting or surprising fact about microbiology is the exi.pdf
The most iteresting or surprising fact about microbiology is the exi.pdfThe most iteresting or surprising fact about microbiology is the exi.pdf
The most iteresting or surprising fact about microbiology is the exi.pdf
ankitcom
 
The electrophilic aromatic substitution decreases ifelectron with dr.pdf
The electrophilic aromatic substitution decreases ifelectron with dr.pdfThe electrophilic aromatic substitution decreases ifelectron with dr.pdf
The electrophilic aromatic substitution decreases ifelectron with dr.pdf
ankitcom
 
The buffer solution contains the following species in solutionHCH.pdf
The buffer solution contains the following species in solutionHCH.pdfThe buffer solution contains the following species in solutionHCH.pdf
The buffer solution contains the following species in solutionHCH.pdf
ankitcom
 
That is Distributive propertySolutionThat is Distributive prop.pdf
That is Distributive propertySolutionThat is Distributive prop.pdfThat is Distributive propertySolutionThat is Distributive prop.pdf
That is Distributive propertySolutionThat is Distributive prop.pdf
ankitcom
 
System Maintenance         System maintenance is a current action,.pdf
System Maintenance         System maintenance is a current action,.pdfSystem Maintenance         System maintenance is a current action,.pdf
System Maintenance         System maintenance is a current action,.pdf
ankitcom
 
Sr(OH)2 Solution Sr(OH)2.pdf
                     Sr(OH)2  Solution                     Sr(OH)2.pdf                     Sr(OH)2  Solution                     Sr(OH)2.pdf
Sr(OH)2 Solution Sr(OH)2.pdf
ankitcom
 
sol It says that it absorbs 322 J of heat, there.pdf
                     sol It says that it absorbs 322 J of heat, there.pdf                     sol It says that it absorbs 322 J of heat, there.pdf
sol It says that it absorbs 322 J of heat, there.pdf
ankitcom
 
Reverse transcriptase is an enzyme present in some of the virses whi.pdf
Reverse transcriptase is an enzyme present in some of the virses whi.pdfReverse transcriptase is an enzyme present in some of the virses whi.pdf
Reverse transcriptase is an enzyme present in some of the virses whi.pdf
ankitcom
 
public class InsufficientFundsException extends Exception{Insuffic.pdf
public class InsufficientFundsException extends Exception{Insuffic.pdfpublic class InsufficientFundsException extends Exception{Insuffic.pdf
public class InsufficientFundsException extends Exception{Insuffic.pdf
ankitcom
 
Plug in real numbers for a and b.Since it isnSolutionPlug in.pdf
Plug in real numbers for a and b.Since it isnSolutionPlug in.pdfPlug in real numbers for a and b.Since it isnSolutionPlug in.pdf
Plug in real numbers for a and b.Since it isnSolutionPlug in.pdf
ankitcom
 
momSolutionmom.pdf
momSolutionmom.pdfmomSolutionmom.pdf
momSolutionmom.pdf
ankitcom
 
Retention factor (Rƒ) is the distance travelled b.pdf
                     Retention factor (Rƒ) is the distance travelled b.pdf                     Retention factor (Rƒ) is the distance travelled b.pdf
Retention factor (Rƒ) is the distance travelled b.pdf
ankitcom
 
Java doesnt support multiple inheritance, therefore a class cannot.pdf
Java doesnt support multiple inheritance, therefore a class cannot.pdfJava doesnt support multiple inheritance, therefore a class cannot.pdf
Java doesnt support multiple inheritance, therefore a class cannot.pdf
ankitcom
 
In pc engineering, pc design is that the abstract style and elementa.pdf
In pc engineering, pc design is that the abstract style and elementa.pdfIn pc engineering, pc design is that the abstract style and elementa.pdf
In pc engineering, pc design is that the abstract style and elementa.pdf
ankitcom
 
In the year 1900, the maximum number of deaths occurred due to infec.pdf
In the year 1900, the maximum number of deaths occurred due to infec.pdfIn the year 1900, the maximum number of deaths occurred due to infec.pdf
In the year 1900, the maximum number of deaths occurred due to infec.pdf
ankitcom
 
home.htmlStarted!DOCTYPE html html la.pdf
home.htmlStarted!DOCTYPE html html la.pdfhome.htmlStarted!DOCTYPE html html la.pdf
home.htmlStarted!DOCTYPE html html la.pdf
ankitcom
 
Pb3O4 -- PbO + Pb2O3 hence the mole ratio of le.pdf
                     Pb3O4 -- PbO + Pb2O3  hence the mole ratio of le.pdf                     Pb3O4 -- PbO + Pb2O3  hence the mole ratio of le.pdf
Pb3O4 -- PbO + Pb2O3 hence the mole ratio of le.pdf
ankitcom
 

More from ankitcom (20)

using the equation P1V1T1 = P2V2T2 we have .pdf
                     using the equation P1V1T1 = P2V2T2  we have  .pdf                     using the equation P1V1T1 = P2V2T2  we have  .pdf
using the equation P1V1T1 = P2V2T2 we have .pdf
 
Yes, theyre right. .pdf
                     Yes, theyre right.                             .pdf                     Yes, theyre right.                             .pdf
Yes, theyre right. .pdf
 
we do not have rights to delete questionsSolutionwe do not hav.pdf
we do not have rights to delete questionsSolutionwe do not hav.pdfwe do not have rights to delete questionsSolutionwe do not hav.pdf
we do not have rights to delete questionsSolutionwe do not hav.pdf
 
The most iteresting or surprising fact about microbiology is the exi.pdf
The most iteresting or surprising fact about microbiology is the exi.pdfThe most iteresting or surprising fact about microbiology is the exi.pdf
The most iteresting or surprising fact about microbiology is the exi.pdf
 
The electrophilic aromatic substitution decreases ifelectron with dr.pdf
The electrophilic aromatic substitution decreases ifelectron with dr.pdfThe electrophilic aromatic substitution decreases ifelectron with dr.pdf
The electrophilic aromatic substitution decreases ifelectron with dr.pdf
 
The buffer solution contains the following species in solutionHCH.pdf
The buffer solution contains the following species in solutionHCH.pdfThe buffer solution contains the following species in solutionHCH.pdf
The buffer solution contains the following species in solutionHCH.pdf
 
That is Distributive propertySolutionThat is Distributive prop.pdf
That is Distributive propertySolutionThat is Distributive prop.pdfThat is Distributive propertySolutionThat is Distributive prop.pdf
That is Distributive propertySolutionThat is Distributive prop.pdf
 
System Maintenance         System maintenance is a current action,.pdf
System Maintenance         System maintenance is a current action,.pdfSystem Maintenance         System maintenance is a current action,.pdf
System Maintenance         System maintenance is a current action,.pdf
 
Sr(OH)2 Solution Sr(OH)2.pdf
                     Sr(OH)2  Solution                     Sr(OH)2.pdf                     Sr(OH)2  Solution                     Sr(OH)2.pdf
Sr(OH)2 Solution Sr(OH)2.pdf
 
sol It says that it absorbs 322 J of heat, there.pdf
                     sol It says that it absorbs 322 J of heat, there.pdf                     sol It says that it absorbs 322 J of heat, there.pdf
sol It says that it absorbs 322 J of heat, there.pdf
 
Reverse transcriptase is an enzyme present in some of the virses whi.pdf
Reverse transcriptase is an enzyme present in some of the virses whi.pdfReverse transcriptase is an enzyme present in some of the virses whi.pdf
Reverse transcriptase is an enzyme present in some of the virses whi.pdf
 
public class InsufficientFundsException extends Exception{Insuffic.pdf
public class InsufficientFundsException extends Exception{Insuffic.pdfpublic class InsufficientFundsException extends Exception{Insuffic.pdf
public class InsufficientFundsException extends Exception{Insuffic.pdf
 
Plug in real numbers for a and b.Since it isnSolutionPlug in.pdf
Plug in real numbers for a and b.Since it isnSolutionPlug in.pdfPlug in real numbers for a and b.Since it isnSolutionPlug in.pdf
Plug in real numbers for a and b.Since it isnSolutionPlug in.pdf
 
momSolutionmom.pdf
momSolutionmom.pdfmomSolutionmom.pdf
momSolutionmom.pdf
 
Retention factor (Rƒ) is the distance travelled b.pdf
                     Retention factor (Rƒ) is the distance travelled b.pdf                     Retention factor (Rƒ) is the distance travelled b.pdf
Retention factor (Rƒ) is the distance travelled b.pdf
 
Java doesnt support multiple inheritance, therefore a class cannot.pdf
Java doesnt support multiple inheritance, therefore a class cannot.pdfJava doesnt support multiple inheritance, therefore a class cannot.pdf
Java doesnt support multiple inheritance, therefore a class cannot.pdf
 
In pc engineering, pc design is that the abstract style and elementa.pdf
In pc engineering, pc design is that the abstract style and elementa.pdfIn pc engineering, pc design is that the abstract style and elementa.pdf
In pc engineering, pc design is that the abstract style and elementa.pdf
 
In the year 1900, the maximum number of deaths occurred due to infec.pdf
In the year 1900, the maximum number of deaths occurred due to infec.pdfIn the year 1900, the maximum number of deaths occurred due to infec.pdf
In the year 1900, the maximum number of deaths occurred due to infec.pdf
 
home.htmlStarted!DOCTYPE html html la.pdf
home.htmlStarted!DOCTYPE html html la.pdfhome.htmlStarted!DOCTYPE html html la.pdf
home.htmlStarted!DOCTYPE html html la.pdf
 
Pb3O4 -- PbO + Pb2O3 hence the mole ratio of le.pdf
                     Pb3O4 -- PbO + Pb2O3  hence the mole ratio of le.pdf                     Pb3O4 -- PbO + Pb2O3  hence the mole ratio of le.pdf
Pb3O4 -- PbO + Pb2O3 hence the mole ratio of le.pdf
 

Recently uploaded

Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 

Recently uploaded (20)

Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 

Hi,I have updated the code. It is workin fine as expected. Highlig.pdf

  • 1. Hi, I have updated the code. It is workin fine as expected. Highlighted the code changes below. #include int main(void) { int totalVal = 0; int userInt = 0; int temp = 0; // FIXME: Ask user to input an integer, store in userInt printf("Enter an integer: "); scanf("%d", &userInt); temp = userInt; totalVal = userInt; // FIXME: Add while loop that counts down to 1, updating totalVal while(userInt != 1){ userInt--; totalVal = totalVal * userInt; } userInt = temp; printf("%d! is %d ", userInt, totalVal); return 0; } Output: Enter an integer: 5 5! is 120 Solution Hi, I have updated the code. It is workin fine as expected. Highlighted the code changes below.
  • 2. #include int main(void) { int totalVal = 0; int userInt = 0; int temp = 0; // FIXME: Ask user to input an integer, store in userInt printf("Enter an integer: "); scanf("%d", &userInt); temp = userInt; totalVal = userInt; // FIXME: Add while loop that counts down to 1, updating totalVal while(userInt != 1){ userInt--; totalVal = totalVal * userInt; } userInt = temp; printf("%d! is %d ", userInt, totalVal); return 0; } Output: Enter an integer: 5 5! is 120