0% found this document useful (0 votes)
18 views18 pages

C Language Assignment Solutions

The document provides solutions to various coding assignments including examples using for loops, while loops, continue statements, if/else statements, switch statements, recursion, binary search trees, and closures in C and JavaScript. It also includes links to examples of recursion and binary search tree code on an external site due to size constraints.

Uploaded by

Akash sherkar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views18 pages

C Language Assignment Solutions

The document provides solutions to various coding assignments including examples using for loops, while loops, continue statements, if/else statements, switch statements, recursion, binary search trees, and closures in C and JavaScript. It also includes links to examples of recursion and binary search tree code on an external site due to size constraints.

Uploaded by

Akash sherkar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Solution of Assignment 7.

1) For Loop
Solution of Assignment 7.1

Example : For Loop (Using C Lang)


Solution of Assignment 7.1

2) While Loop
Solution of Assignment 7.1

Example: While Loop (Using C Lang)


Solution of Assignment 7.1

3) Continue
Solution of Assignment 7.1

Example Of Continue (Using C Lang)


Solution of Assignment 7.1

4) If-else
Solution of Assignment 7.1

Example of If-Else (Using C Lang)


Solution of Assignment 7.1

5) Swith
Solution of Assignment 7.1

Example of Switch (Using C Lang)


Solution of Assignment 7.1

Recursion:
Solution of Assignment 7.1

Flowchart Recursion:
Solution of Assignment 7.1

Example of Recursion:
Solution of Assignment 7.1

Binary Search Tree:


Solution of Assignment 7.1

Example: Due to large code size I’m not able to take the snap of code please
find below vpaste link, I have uploaded code on the vpaste

[Link]
Solution of Assignment 7.1

Closure:
Solution of Assignment 7.1

Write an implementation of getElementByld, which performs the same basic


task as that of actual getElementByld, (don't use shortcuts like queryselector)

def getElementByld(element_id, root=None):


if root is None:
root = [Link]

if [Link]("id") == element_id:
return root

for child in [Link]:


result = getElementByld(element_id, child)
if result is not None:
return result
return None
Solution of Assignment 7.1

Given a number x, find out if it is a prime number or not, use javascript and
find out the difference between Next prime number after X and X.

Solution:- [Link]

You might also like