Search for notes by fellow students, in your own course and all over the country.

Browse our notes for titles which look like what you need, you can preview any of the notes via a sample of the contents. After you're happy these are the notes you're after simply pop them into your shopping cart.

My Basket

You have nothing in your shopping cart yet.

Title: If else While loop
Description: If else While loop

Document Preview

Extracts from the notes are below, to see the PDF you'll receive please use the links above


Chapter 3
If-Else, While loop & Lots of Patterns
In this we will learn the syntax of conditional statements in CPP
...
We will also be given a number "A"
and asked to print positive if "A" is positive, otherwise print not
positive
...
For instance, if "A" is 5, then if "A" is -2 and if "A" is -5, then it
will print anything
...
But if we add an "else"
block here, then this block will be executed
...
get()" takes input in the form of characters and that it took "1" as a
character, but we are assigning this value to an integer so that's why it
printed its ASCII value
...
Let's code to determine
which number is greater
...
However, this information is not relevant to the
topic at hand
...
We will use a
variable i to keep track of the row number, and then we will simply
print a star in each column
...
In the next
video, we will do more pattern problems and also code a triangular
figure
...
Data types are also used to test data

types and identify types of data types, such as C, D, E, dtype, and etype
...

We will run a loop from 1 to n , ( for all rows ) We declared a variable i
to keep the track of the row number and then we are simply printing
star in each column Then we wrote this cout < endl , to come to a new
line , and after that this code will get executed for every row
...
We will code this
triangular figure also in next video
...

We will run a loop from 1 to n , ( for all rows ) Then we declared a
variable J for columns
...
Then we incremented J inside the column loop
and Incrementing i inside the row loop after printing ENTER
...
Also we can notice that number of stars in a
particular row is equal to the row number which is 'i' Now let 's take a
variable count=1 and we will print this count and then increment it
outside this loop
...
Then after printing it inside col loop , we will keep on
incrementing it by 1 There is an another method for this question But
first let 's write the code for this one We can't simply print row and
increment it , because then our program will misbehave
...

We have done 9 pattern questions
...
Next pattern looks like this 1st obs row = n 2nd obs- A is mapped to 1 , B is mapping to 2 and so on
...

We got our counting correct but just had to map 1 to ' A ' so to do so ,
we added ' A -1 on both sides , so to
...
We just have to print ' A'+i 1 , but it will be typecasted to integer so to avoid that
...
Bhaiya: We have to find a
relation for printing our answer
...
We can see their dependence on
row number and col number
...
Also 'A ' will be there for sure
...
So this is our formula
...
We just have to find the starting character
...
Do
this one Now let 's try out this variant
...
These are very easy questions if you have
understood previous questions
...
If you are
able to do this one without my help, then it is very good for you
...
I will tell it 's
solution and then give you one more question to try as your homework
...
In next one , we will see operators , bitwise
operators , For loop , and many more interesting things


Title: If else While loop
Description: If else While loop