Questions tagged [control-statements]
5 questions
3
votes
6 answers
Is there any difference between conditional statement and control statement in C?
My friend is preparing for the some bank exam. And the question asked was:
What are the control statement below?
Options
1. `if` and `switch`
2. `break` and `if`
3. `if` and `while`
4. `break` and `continue`
and correct answer marked was 1
I…

VINOTH ENERGETIC
- 1,775
- 4
- 23
- 38
1
vote
3 answers
I need to write a loop that makes seven calls to console.log to output the following inverse triangle?
#######
######
#####
####
###
##
#
The above question is the problem from the book eloquent javascript. But the question was different as:
Write a loop that makes seven calls to console.log to output the following…

Bluefin zen
- 43
- 7
0
votes
2 answers
Write a function that reads a file and returns all of the numbers in it as a list of floats
I have a large text file containing many thousand lines but a short example that covers the same idea is:
vapor dust -2C pb
x14 71 hello! 42.42
100,000 lover baby: -2
there is a mixture of integers, alphanumerics, and floats.
ATTEMPT AT SOLN.
Ive…

Himi Chan
- 3
- 2
0
votes
0 answers
Why this java code always print "Unknown City" for any value input by the user?
This Java program is successfully compiled and run and accepting input from the user but for every city value(Meerut, Noida, Agra), it is showing "Unknown City" Why?? Why it is always executing else condition?? I have used both sc.next() and…

Kabir Joseph
- 46
- 1
-2
votes
2 answers
Java If-Else in HackerRank, Is my code good or can I get better solution for the problem
Problem Statement
Task
Given an integer,n, perform the following conditional actions:
If n is odd, print Weird
If n is even and in the inclusive range of 2 to 5, print Not Weird
If n is even and in the inclusive range of 6 to 20, print Weird
If n is…

KamalAres
- 11
- 1
- 5