program till the condition is true and the keyword used for loop is "while".
expression here)
the condition is true :
our daily life, so a program without decision is an empty box.
()and else
program we can use the key word “If()”and “else ()”and you can also use
the C style
We
can also use”&&” for saying compiler “and” and for saying compiler or
we can use “or”
of if and else statement
statement is as follow:
type ((condition1 here) && (and
2 here)) and if you want to use “or” replace && with “or”
Statement
1 here ;
Statement
2 here ;
years old are you?" <<"\n" ;
"you can play foot ball easily";
"you can't play football";
You
can also use these programs by using operators. If you have any doubt you can
add pretences. Eg after declaring variables you can just type x=4 + y then the
x value will be 4+y’s value (but in the C’s typing style)
Our second program in C
int ho;
cout <<"how many years old are you?"
<<"\n" ;
cin >> ho;
cout << "you are " << ho <<" years
old";
will ask you “how many years old are you” and then it will tell you your age
there are many commands which I have explained above so I will not repeat them
have typed “int ho;” this line will declare the variable “ho”.
cout we have type “<<” to times so in one cout so I m telling you that
you can print as many thing as you want on screen by putting “<<” in one
cout.
“\n”, it will tell program to go to next line.
typed “cin >> ho;” this will give user a chance to enter his/her data and
after pressing enter computer will store the data in the variable “ho”.
“cout << “you are”” we have typed “<< ho” without quotes mark this
mean that it will not print ho instead it will print ho’s value.
calculation put bracket in that place
Bracket
and comments are free mean they can be used freely.
(In C) In
calculations only parentheses are used not any other brackets
(In
C) are use to assign a value to a variable and that operator is
expressions on left hand side of any assignment operator. X=X+1=X’s old value + 1
Arithmetic operations (Remember that
right hand side of = is not effected by the operation) and only the
following operators are use for Arithmetic operations:
= 2 – 1 = 1
= 4 / 2 = 2
Dividing by 0 is illegal and if division is of integers then
fractional part of that division will truncate. All unknowns are variables
1
kind or comparison and only following operator are use:
of ignorance and they are as follow:
showing false (!(true
condition here))
showing true (!(false
condition here))
solve, then + and – are solve.
The
expressions are solve left to right (in C)
Keywords
There are certain
keywords like “main ()”and are a followed:
While ( )
Do ( )
For( )
The style
of writing program is important because it tells program about the group of commands
can use them to store our data in them.
In c to use variables we, first have to declare them.
of location in memory.
of data which we can store in it.
of the variable on memory
which we store in it.
declaring that variables which can store normal integer’s data.
Is used for declaring that
variables which can store less integer’s data than int’s variables
use.
Is used for declaring
that variables which can store more integer’s data than int’s variables
use.
Is used for declaring
that variables which can store decimals.
Is used for declaring
that variables which can store more decimals than float command.
Is used for declaring
that variables which can store characters.
“variable’s type then variable’s name
then ;”, in the middle of braces of “main” and for declaring a variable
which’s value is already assigned type “variable’s
type then variable’s name then = your value ;”,
Our
first c program
Cout << “Hello everybody”:
compile it
of our program is preprocessor which help us to get our output.
will start and this line come only and only 1 time in the whole program.
is at beginning and second is at last) which are used to enclose our
program and we must have to type our whole program in it. (Otherwise you can’t compile you program)
<< “Hello everybody” ;”
braces. The
to.
use in every end of C statement.
use command prompt
And then install and run