Post #1

 Sample Answers For programming questions I had faced in Uni.

I am a student at private uni in Sri Lanka and here I give sample answers to questions that I faced in the first semester.

*Programming language is C.

Q1)


There are 3 types of rooms and it is divided into two groups as Full board(F) and Half board(H).

The program should allow the user to enter the order until -1 is entered for the room type.
👉So, there should be a Sentinel-Controlled Repetition.

*First, take inputs inside the loop.
*After taking input of room type check whether that is equal to '-1'.


*Afterwards taking all inputs there should be statements for conditions given.
*Then there should be calculations related to the question.
*Finally, output the values.

So the final code looks like this.

Disclaimer
This is not the only way to solve the question. Try different ways.

#This idea came because of this video. If you are a guy who has an interest in the IT sector this video might be helpful for you & that is in Sinhala :)
#If the content is so complicated feel free to contact me on telegram 

@hasindu_koshitha

Comments

Popular posts from this blog

How to Check for NVIDIA GPU and Set It Up in Ubuntu

Use the Google Custom Search JSON API to retrieve images

How to Remove a File or Folder from Git Without Losing It Locally