SlideShare a Scribd company logo
1 of 2
Please give me some instrcations to follow to get the output of this C cods?
#include<stdio.h>
int cal1 (int p, double q){
int w;
w = p -q / 4 *( p % 5);
return (w-1);
}
double cal2 (double t){
int i;
double tt;
tt = 0.0;
for (i=1; i <= t; ++i)
tt = tt + cal1(i,t);
return (tt*t);
}
int main (void){
printf ("%.4f ", cal2(4.0));
return (0);}
Solution
* Declare the function in header
// Example program
#include <iostream>
#include <string>
//function prototype also called function declaration
int cal1 (int p, double q);
double cal2 (double t);
int cal1 (int p, double q){
int w;
w = p -q / 4 *( p % 5);
return (w-1);
}
double cal2 (double t){
int i;
double tt;
tt = 0.0;
for (i=1; i <= t; ++i)
tt = tt + cal1(i,t);
return (tt*t);
}
int main()
{
printf ("%.4f ", cal2(2.0));
return (0);
}

More Related Content

More from ellenj4

The following table contains national income accounting data for a hyp.docx
The following table contains national income accounting data for a hyp.docxThe following table contains national income accounting data for a hyp.docx
The following table contains national income accounting data for a hyp.docxellenj4
 
The following items are taken from the financial statements of the Pos.docx
The following items are taken from the financial statements of the Pos.docxThe following items are taken from the financial statements of the Pos.docx
The following items are taken from the financial statements of the Pos.docxellenj4
 
The following program has already been written to populate its data ar.docx
The following program has already been written to populate its data ar.docxThe following program has already been written to populate its data ar.docx
The following program has already been written to populate its data ar.docxellenj4
 
The German philosopher Immanuel Kant condemned Utilitarianism as an im.docx
The German philosopher Immanuel Kant condemned Utilitarianism as an im.docxThe German philosopher Immanuel Kant condemned Utilitarianism as an im.docx
The German philosopher Immanuel Kant condemned Utilitarianism as an im.docxellenj4
 
The graph of temperature versus molar mass is given for the hydrides o.docx
The graph of temperature versus molar mass is given for the hydrides o.docxThe graph of temperature versus molar mass is given for the hydrides o.docx
The graph of temperature versus molar mass is given for the hydrides o.docxellenj4
 
The general role of financial intermediaries is to- A-Provide advice t (1).docx
The general role of financial intermediaries is to- A-Provide advice t (1).docxThe general role of financial intermediaries is to- A-Provide advice t (1).docx
The general role of financial intermediaries is to- A-Provide advice t (1).docxellenj4
 
The general role of financial intermediaries is to- A-Provide advice t.docx
The general role of financial intermediaries is to- A-Provide advice t.docxThe general role of financial intermediaries is to- A-Provide advice t.docx
The general role of financial intermediaries is to- A-Provide advice t.docxellenj4
 
The functional group RCO2R-' is characteristic of a(n) ____- 1) 2) 3).docx
The functional group RCO2R-' is characteristic of a(n) ____- 1) 2) 3).docxThe functional group RCO2R-' is characteristic of a(n) ____- 1) 2) 3).docx
The functional group RCO2R-' is characteristic of a(n) ____- 1) 2) 3).docxellenj4
 
The following information pertains to Naomi Campbell Company as of Dec.docx
The following information pertains to Naomi Campbell Company as of Dec.docxThe following information pertains to Naomi Campbell Company as of Dec.docx
The following information pertains to Naomi Campbell Company as of Dec.docxellenj4
 
The G Banking Group recently reported that it was offshoring (moving).docx
The G Banking Group recently reported that it was offshoring (moving).docxThe G Banking Group recently reported that it was offshoring (moving).docx
The G Banking Group recently reported that it was offshoring (moving).docxellenj4
 
Please do not answer if you-'re unsure of the answer- Thanks!.docx
Please do not answer if you-'re unsure of the answer- Thanks!.docxPlease do not answer if you-'re unsure of the answer- Thanks!.docx
Please do not answer if you-'re unsure of the answer- Thanks!.docxellenj4
 
Please describe the process of the Implementation of Role-based access.docx
Please describe the process of the Implementation of Role-based access.docxPlease describe the process of the Implementation of Role-based access.docx
Please describe the process of the Implementation of Role-based access.docxellenj4
 
please define and describe the following- web server- application serv.docx
please define and describe the following- web server- application serv.docxplease define and describe the following- web server- application serv.docx
please define and describe the following- web server- application serv.docxellenj4
 
Please assist- Done perfectly- Portland uses sodium hydroxide (NaOH).docx
Please assist- Done perfectly-  Portland uses sodium hydroxide (NaOH).docxPlease assist- Done perfectly-  Portland uses sodium hydroxide (NaOH).docx
Please assist- Done perfectly- Portland uses sodium hydroxide (NaOH).docxellenj4
 
Please answer question b In normal mitochondria the rate of electron t.docx
Please answer question b In normal mitochondria the rate of electron t.docxPlease answer question b In normal mitochondria the rate of electron t.docx
Please answer question b In normal mitochondria the rate of electron t.docxellenj4
 
Please answer in complete sentences What are the major reasons for acc.docx
Please answer in complete sentences What are the major reasons for acc.docxPlease answer in complete sentences What are the major reasons for acc.docx
Please answer in complete sentences What are the major reasons for acc.docxellenj4
 
PLEASE answer carefully as this question will come to my test so dont.docx
PLEASE answer carefully as this question will come to my test so dont.docxPLEASE answer carefully as this question will come to my test so dont.docx
PLEASE answer carefully as this question will come to my test so dont.docxellenj4
 
PKI Concepts- What are the core components of a PKI- Briefly describe.docx
PKI Concepts- What are the core components of a PKI- Briefly describe.docxPKI Concepts- What are the core components of a PKI- Briefly describe.docx
PKI Concepts- What are the core components of a PKI- Briefly describe.docxellenj4
 
Pioneering work in science can be dangerous- Give examples of scientif.docx
Pioneering work in science can be dangerous- Give examples of scientif.docxPioneering work in science can be dangerous- Give examples of scientif.docx
Pioneering work in science can be dangerous- Give examples of scientif.docxellenj4
 

More from ellenj4 (19)

The following table contains national income accounting data for a hyp.docx
The following table contains national income accounting data for a hyp.docxThe following table contains national income accounting data for a hyp.docx
The following table contains national income accounting data for a hyp.docx
 
The following items are taken from the financial statements of the Pos.docx
The following items are taken from the financial statements of the Pos.docxThe following items are taken from the financial statements of the Pos.docx
The following items are taken from the financial statements of the Pos.docx
 
The following program has already been written to populate its data ar.docx
The following program has already been written to populate its data ar.docxThe following program has already been written to populate its data ar.docx
The following program has already been written to populate its data ar.docx
 
The German philosopher Immanuel Kant condemned Utilitarianism as an im.docx
The German philosopher Immanuel Kant condemned Utilitarianism as an im.docxThe German philosopher Immanuel Kant condemned Utilitarianism as an im.docx
The German philosopher Immanuel Kant condemned Utilitarianism as an im.docx
 
The graph of temperature versus molar mass is given for the hydrides o.docx
The graph of temperature versus molar mass is given for the hydrides o.docxThe graph of temperature versus molar mass is given for the hydrides o.docx
The graph of temperature versus molar mass is given for the hydrides o.docx
 
The general role of financial intermediaries is to- A-Provide advice t (1).docx
The general role of financial intermediaries is to- A-Provide advice t (1).docxThe general role of financial intermediaries is to- A-Provide advice t (1).docx
The general role of financial intermediaries is to- A-Provide advice t (1).docx
 
The general role of financial intermediaries is to- A-Provide advice t.docx
The general role of financial intermediaries is to- A-Provide advice t.docxThe general role of financial intermediaries is to- A-Provide advice t.docx
The general role of financial intermediaries is to- A-Provide advice t.docx
 
The functional group RCO2R-' is characteristic of a(n) ____- 1) 2) 3).docx
The functional group RCO2R-' is characteristic of a(n) ____- 1) 2) 3).docxThe functional group RCO2R-' is characteristic of a(n) ____- 1) 2) 3).docx
The functional group RCO2R-' is characteristic of a(n) ____- 1) 2) 3).docx
 
The following information pertains to Naomi Campbell Company as of Dec.docx
The following information pertains to Naomi Campbell Company as of Dec.docxThe following information pertains to Naomi Campbell Company as of Dec.docx
The following information pertains to Naomi Campbell Company as of Dec.docx
 
The G Banking Group recently reported that it was offshoring (moving).docx
The G Banking Group recently reported that it was offshoring (moving).docxThe G Banking Group recently reported that it was offshoring (moving).docx
The G Banking Group recently reported that it was offshoring (moving).docx
 
Please do not answer if you-'re unsure of the answer- Thanks!.docx
Please do not answer if you-'re unsure of the answer- Thanks!.docxPlease do not answer if you-'re unsure of the answer- Thanks!.docx
Please do not answer if you-'re unsure of the answer- Thanks!.docx
 
Please describe the process of the Implementation of Role-based access.docx
Please describe the process of the Implementation of Role-based access.docxPlease describe the process of the Implementation of Role-based access.docx
Please describe the process of the Implementation of Role-based access.docx
 
please define and describe the following- web server- application serv.docx
please define and describe the following- web server- application serv.docxplease define and describe the following- web server- application serv.docx
please define and describe the following- web server- application serv.docx
 
Please assist- Done perfectly- Portland uses sodium hydroxide (NaOH).docx
Please assist- Done perfectly-  Portland uses sodium hydroxide (NaOH).docxPlease assist- Done perfectly-  Portland uses sodium hydroxide (NaOH).docx
Please assist- Done perfectly- Portland uses sodium hydroxide (NaOH).docx
 
Please answer question b In normal mitochondria the rate of electron t.docx
Please answer question b In normal mitochondria the rate of electron t.docxPlease answer question b In normal mitochondria the rate of electron t.docx
Please answer question b In normal mitochondria the rate of electron t.docx
 
Please answer in complete sentences What are the major reasons for acc.docx
Please answer in complete sentences What are the major reasons for acc.docxPlease answer in complete sentences What are the major reasons for acc.docx
Please answer in complete sentences What are the major reasons for acc.docx
 
PLEASE answer carefully as this question will come to my test so dont.docx
PLEASE answer carefully as this question will come to my test so dont.docxPLEASE answer carefully as this question will come to my test so dont.docx
PLEASE answer carefully as this question will come to my test so dont.docx
 
PKI Concepts- What are the core components of a PKI- Briefly describe.docx
PKI Concepts- What are the core components of a PKI- Briefly describe.docxPKI Concepts- What are the core components of a PKI- Briefly describe.docx
PKI Concepts- What are the core components of a PKI- Briefly describe.docx
 
Pioneering work in science can be dangerous- Give examples of scientif.docx
Pioneering work in science can be dangerous- Give examples of scientif.docxPioneering work in science can be dangerous- Give examples of scientif.docx
Pioneering work in science can be dangerous- Give examples of scientif.docx
 

Recently uploaded

microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
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
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
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
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
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
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 

Recently uploaded (20)

microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
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 ...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
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
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
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
 
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
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
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"
 

Please give me some instrcations to follow to get the output of this C.docx

  • 1. Please give me some instrcations to follow to get the output of this C cods? #include<stdio.h> int cal1 (int p, double q){ int w; w = p -q / 4 *( p % 5); return (w-1); } double cal2 (double t){ int i; double tt; tt = 0.0; for (i=1; i <= t; ++i) tt = tt + cal1(i,t); return (tt*t); } int main (void){ printf ("%.4f ", cal2(4.0)); return (0);} Solution * Declare the function in header // Example program #include <iostream> #include <string> //function prototype also called function declaration int cal1 (int p, double q); double cal2 (double t); int cal1 (int p, double q){ int w; w = p -q / 4 *( p % 5);
  • 2. return (w-1); } double cal2 (double t){ int i; double tt; tt = 0.0; for (i=1; i <= t; ++i) tt = tt + cal1(i,t); return (tt*t); } int main() { printf ("%.4f ", cal2(2.0)); return (0); }