Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
23 views
Lecture 8 Coding Questions
Uploaded by
syash9457
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Lecture 8 Coding Questions For Later
Download
Save
Save Lecture 8 Coding Questions For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
23 views
Lecture 8 Coding Questions
Uploaded by
syash9457
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Lecture 8 Coding Questions For Later
Carousel Previous
Carousel Next
Save
Save Lecture 8 Coding Questions For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 22
Search
Fullscreen
‘Question Not ‘single File Programming Question Problem statement sarah is studying number theory ands curious about the sum of avisos of a given number. She wants to write a C++ program to calculate this. Can you help horn witing a program thot takes « positive integer as input an calculates the sum of ts dvsors using @ roference valable? Function Name: void calculateDivisersum Note: This is e'2ample question asked in infosys rerultmant. Input format: The input consists of an integer N Output format : Te output displaye the eum ofall the aivisars of N‘Output format : The output displays the sum of all the divisors of N. Code constraints : 1<= N= 00 ‘Sample test cases: Input: 5 Whitelist set: ‘Outputtices iret emsCnee sy Pesan e eeaa F void calculatepivisorsum(int num, int &sum) { re a irae ee ean ees eg Pec rene ener : 3 raccoons int N; Cea Bae PRE ete Tete neta eect) Coe Se RE el MSU otStotue Conect rt bined ft) Hes wes O Trescompled 2 Tnansubrited 1 Lowe Kany Gusten ype Shglaflamogrmming Subject C44 opie Rietone Sub Tope Relweneavaranae Suan teensy crate TD shom eetcase sree (7) Show eoiion est s/s Testooses Passed ‘compiier Messogetna at cepteseutnt Timotve) Time comploty space Compatty wossageSolution 1 Parra es ers using namespace std; void calculateDivisorsum(int number, int& sum) ( Sec Gi are recon eee eg if (number % i == 0) { Ere ey } i Cran Tv ules at rear ae Peyton tetra strc cout << divisorsum; SSeS‘ouesionno:2 Single Fle Programming Question sores oma ents ah eso analysts rumba dole tha sum she recent rte rogram ofa hase humus sia funeton eal wm) Teather ‘nroton sve created a progam fa slowshertoiput aca numbers ond amputathari uangine cones eal by Voie hn Sarohuns progre, snes prema art the rumba on by ne tr inpting enue. he progr noes the sunt. tune, th rumba ore oss vive, mecring ht he rg! elves oe nat modded. hs uncon ees og ta povided umber, occuulng em ‘ce me computations cares th rgto dps he sumo th een owing oth toque anaye the et rurale The Cal by Vue approach ensures a the ‘gra rursarsreman unsnanged, proving Saran th acuta rents and gresrng neg thei Sot ‘ote: nis sample question asad in Capgernnieetutner rot tormet ‘eatin helmut cana tne tn‘Output format: The output prints the sum of elements. ‘Sample test cases: Input: Output: 5 220 “u 36 Input2: output2: e 2046 Pry 456 709 uz 258 369 951 753Whitelist gd cect eH ae Crees ae cece ey (CCl ae oa totalsum ~ arr[i]; ocr parent cae tae (Coaren aeeaL ae coo ne COneratee 7 Poon ee Coy Cormeen eer eyFill your code here omen Bc ae Ca ea eS poesia (Ci Oe ae ee Poca cer resctnn pareOnes ae ca Ce (Cri Oe aU Sa ee Shera esh i int result - sum(arr, n); Pov sere sears CH‘tote caret onsnones Oho ries @ nnwcengi 1 Terie 1 lent Gan Cusine Sngeemepunming Snes Ge erence roe compte enoneepi op tte xpSolution 1 PEustreaeserer ts int sum(int a[], int n) { ae ea Ch seat ae aa ae ee ee Sear eae i eee i int main() Ulam cya) oe cae a mee ae mean ae eso eg Be Uesaried Fy i ita = sum(a, n)3 Bee eee eae Eet UT TES Deteatin es ° ‘Single Fle Programming Question obi totement Aes, amat ernst worn rata 9 rogiom that calcustesthepanerataghennumbr Se cede tolmplement futon cae power) ht nk n to parameters th ass ‘umber an tbe poner (p). Heve toe worse ue cay eencs to pero Me caution. ace rapa prompt neuer ener tetas ba nd the poner hy wi olen th np cr prove he power) fcson coe wih the memory eset he base number athe panes. The fuetin prs the pcos cok uations oe update teva the meray aces of tebase nant ie ‘ty, Ale pregrom aplasia of owe nba ia ote power ape ae eters sample question ste roe enutent nputermat: ‘enputconis te bape exponentInput format: The input consists of the base and exponent Output format : The output prints the result. ‘Sample test cases: Input}: 53 whitelist set & ‘Output I: 125atten Esra tees reg Ss Pen e ee Pn Neue a re ee Piracy on uae ee Mea ch see eeo ng eran ee a Yi LE ee ord y int main () { ial aa Cee em ria Pena Ee ea ou Cor ee Cee ay foseceneended ering Cota: cue CP. Cal by Rlence Sots Camct Mortctshed Wd Hrtrsad © Tirasconpied 1 Tnernomited 1 ete Mem Gueclntjpe ShglerleReganming Sine! cet Tos Runetane inne caltyitence —ooretanany Apgy 4)e testcase Posse Comper Messagecept pt ope Toot) ave Complety space Comenty Message cempoten ecmeet cannes pt ae ° sess = complnteneuceet gta pt thet etSolution! Pst ees Cree ss PE Neuter S oy} Taco Pra a Bc che Uees oat power(b, ©); ey} L void poner(int® b, int& e) { int result - 1; while (e > 0) { ee ee C4 y std::cout << result;
You might also like
OOP Solved Manual - Watermark
PDF
No ratings yet
OOP Solved Manual - Watermark
104 pages
DS C++ Record 1st Exercise To 6 TH Exsrcise
PDF
No ratings yet
DS C++ Record 1st Exercise To 6 TH Exsrcise
22 pages
PPS Lab Manual
PDF
No ratings yet
PPS Lab Manual
31 pages
121CH0885 Amrut Anubhab Assignment 5,6,7
PDF
No ratings yet
121CH0885 Amrut Anubhab Assignment 5,6,7
9 pages
C Language {Unit 2(Part 1)}[1]
PDF
No ratings yet
C Language {Unit 2(Part 1)}[1]
20 pages
PPS 5th Assignment With Qna
PDF
No ratings yet
PPS 5th Assignment With Qna
20 pages
C Ob From Functions
PDF
No ratings yet
C Ob From Functions
17 pages
List
PDF
No ratings yet
List
4 pages
Assignment 3
PDF
No ratings yet
Assignment 3
21 pages
Basic Handnote of CSE-101 Course
PDF
No ratings yet
Basic Handnote of CSE-101 Course
43 pages
PPS Practical File 1
PDF
No ratings yet
PPS Practical File 1
23 pages
DocScanner Mar 1, 2024 00-59
PDF
No ratings yet
DocScanner Mar 1, 2024 00-59
11 pages
PSTC Unit-4
PDF
No ratings yet
PSTC Unit-4
9 pages
algo lab
PDF
No ratings yet
algo lab
21 pages
Arrays - Class 1
PDF
No ratings yet
Arrays - Class 1
13 pages
Fundamental of Computer and Programming
PDF
No ratings yet
Fundamental of Computer and Programming
40 pages
CH-4 Solved Exercise 10th Class by Taleemcity
PDF
No ratings yet
CH-4 Solved Exercise 10th Class by Taleemcity
10 pages
C-Programming ShortNotes
PDF
No ratings yet
C-Programming ShortNotes
7 pages
fpl set A
PDF
No ratings yet
fpl set A
13 pages
Smart Interviews Notes
PDF
No ratings yet
Smart Interviews Notes
75 pages
OOP Pract. 1
PDF
No ratings yet
OOP Pract. 1
22 pages
Assignment
PDF
No ratings yet
Assignment
7 pages
OPP Assignment 1
PDF
No ratings yet
OPP Assignment 1
19 pages
Introduction To C++
PDF
No ratings yet
Introduction To C++
24 pages
Week 2-6
PDF
No ratings yet
Week 2-6
44 pages
Lecture 8 Single File Programming Questions
PDF
No ratings yet
Lecture 8 Single File Programming Questions
8 pages
Java Assignment 1
PDF
No ratings yet
Java Assignment 1
14 pages
Q. Write A Program in C To Implement Caesar Cipher Algorithm
PDF
No ratings yet
Q. Write A Program in C To Implement Caesar Cipher Algorithm
25 pages
C Programming Lab
PDF
No ratings yet
C Programming Lab
39 pages
Date 170807
PDF
No ratings yet
Date 170807
37 pages
C++ Basic Programs
PDF
No ratings yet
C++ Basic Programs
7 pages
Programmirg Concepts - Using C: La6 Fulanuaf
PDF
No ratings yet
Programmirg Concepts - Using C: La6 Fulanuaf
23 pages
barc C prog
PDF
No ratings yet
barc C prog
17 pages
13-03-Session 1 C
PDF
No ratings yet
13-03-Session 1 C
5 pages
Assignment 2
PDF
No ratings yet
Assignment 2
10 pages
Functions
PDF
No ratings yet
Functions
11 pages
pps exp
PDF
No ratings yet
pps exp
9 pages
CP Important Question Bank Which Can Come
PDF
No ratings yet
CP Important Question Bank Which Can Come
32 pages
MCS-011 Problem Solving and Programming
PDF
No ratings yet
MCS-011 Problem Solving and Programming
13 pages
C++ - Effectively Calculate The Result of Geometric Series - Co
PDF
No ratings yet
C++ - Effectively Calculate The Result of Geometric Series - Co
4 pages
C
PDF
No ratings yet
C
21 pages
Pooja
PDF
No ratings yet
Pooja
8 pages
12th CS - 1 Practical
PDF
No ratings yet
12th CS - 1 Practical
50 pages
PPS Module 1
PDF
No ratings yet
PPS Module 1
10 pages
Code Chef Practice
PDF
No ratings yet
Code Chef Practice
7 pages
PPS EXP. NO.2 and 1
PDF
No ratings yet
PPS EXP. NO.2 and 1
8 pages
Programs
PDF
No ratings yet
Programs
8 pages
Array Extra Cls
PDF
No ratings yet
Array Extra Cls
11 pages
61ccb9eb-c9c9-4cf7-8a80-b8e36c4ba572
PDF
No ratings yet
61ccb9eb-c9c9-4cf7-8a80-b8e36c4ba572
107 pages
CS11001 Programming and Data Structures, Autumn 2014-2015: Class Test 1
PDF
No ratings yet
CS11001 Programming and Data Structures, Autumn 2014-2015: Class Test 1
4 pages
C
PDF
No ratings yet
C
25 pages
C++ Practice Codes
PDF
No ratings yet
C++ Practice Codes
7 pages
4
PDF
No ratings yet
4
6 pages
Auditory Exercises 06 Functions
PDF
No ratings yet
Auditory Exercises 06 Functions
9 pages
PF Lab 4 Summer
PDF
No ratings yet
PF Lab 4 Summer
5 pages
C Primer习题集第5版,(美)李普曼,P520
PDF
No ratings yet
C Primer习题集第5版,(美)李普曼,P520
527 pages
DSA notes (1)
PDF
No ratings yet
DSA notes (1)
18 pages