All Computer Programming languages and its basics (C,C++,JAVA,PHP,SAP(ALL MODULES)
Friday 11 April 2014
Thursday 10 April 2014
Fibonacci series in c using for loop
Fibonacci series in c using for loop
/* Fibonacci Series c language */
#include<stdio.h>
int main()
{
int n, first = 0, second = 1, next, c;
printf("Enter the number of terms\n");
scanf("%d",&n);
printf("First %d terms of Fibonacci series are :-\n",n);
for ( c = 0 ; c < n ; c++ )
{
if ( c <= 1 )
next = c;
else
{
next = first + second;
first = second;
second = next;
}
printf("%d\n",next);
}
return 0;
}
/* Fibonacci Series c language */
#include<stdio.h>
int main()
{
int n, first = 0, second = 1, next, c;
printf("Enter the number of terms\n");
scanf("%d",&n);
printf("First %d terms of Fibonacci series are :-\n",n);
for ( c = 0 ; c < n ; c++ )
{
if ( c <= 1 )
next = c;
else
{
next = first + second;
first = second;
second = next;
}
printf("%d\n",next);
}
return 0;
}
Fibonacci series in c programming
Fibonacci series in c programming: c program for Fibonacci series without and with recursion. Using the code below you can print as many numbers of terms of series as desired. Numbers of Fibonacci sequence are known as Fibonacci numbers. First few numbers of series are 0, 1, 1, 2, 3, 5, 8 etc, Except first two terms in sequence every other term is the sum of two previous terms, For example 8 = 3 + 5 (addition of 3, 5). This sequence has many applications in mathematics and Computer Science.
Fibonacci series in c using for loop
/* Fibonacci Series c language */
#include<stdio.h>
int main()
{
int n, first = 0, second = 1, next, c;
printf("Enter the number of terms\n");
scanf("%d",&n);
printf("First %d terms of Fibonacci series are :-\n",n);
for ( c = 0 ; c < n ; c++ )
{
if ( c <= 1 )
next = c;
else
{
next = first + second;
first = second;
second = next;
}
printf("%d\n",next);
}
return 0;
}
SYSINNOVA Infotech Walkin for Freshers as Trainee Software Consultants
See More
@ www.freshergate.com
See More
@ www.freshergate.com
BSF recruits Chief Engineer & More Vacancies
BSF recruits Chief Engineer & More Vacancies
Border Security Force (BSF) invites application for the recruitment of Chief Engineer & More Vacancies
Company name : Border Security Force (BSF)
Posts : Chief Engineer & More Vacancies
Qualification : Others
Salary : Rs.15600-67000/- p.m
No of Openings : 70
Location : Delhi
Last date to apply : 28th April 2015
Details of Post :
Chief Engineer & More Vacancies
Applications are invited on prescribed proforma from eligible candidatps for
filling up the following Group Officers posts in BSF Air Wing on Deputationfincluding short term contract)/Absorption/Re-employmem basis:
Posts, Pay Scale, Vacancies
Capt/Pilot (DIG) PB-4 (Rs.37400—67000) plus 08
Senior Operations Officer PB-4 (Rs.37400-67000) plus 01
Important dates to remember :
Last date to apply : 30.04.2014
Commandant (Pilot) PB-4 (Rs.37400-67000) plus 14
Second in Command (Pilot) PB-3 (Rs.156UO-39100) plus 05 Grade Pay Rs. 7600/
Deputy Commandantfl’ilot) PB-3 (Rs.15600-39100) plus 08
ChiefEngineer (DIG) PB-4 (Rs.37400—67OOU)1
Deputy Chief Engineer PIS-4 (Rs.37400-67()00) plus 06
Senior Aircraft Maintenance PBMB (Rs. 1 5600-39100) plus 14 Engineer/ Senior Aircraft Radio Grade Pay Rs. 7600/v Maintenance Engineer (Second 5 In Command)
Junior Aircraft Maintenance PB-3 (Rs.15600—391()0) plus – O7 Engineer/ Junior Aircraft Radio Grade Pay Rs. 6600/- ‘ Maintenance Engineer (Deputy Commandant) 10
Equipment Officer/Senior Pay Band 3 (Rs.l’5600-39.[‘OQ’) t ‘ 02 Stores Provisioning Officer Grade Pay Rs. 7600f- – Second-in-Command)
Logistics Officer PB-3iRs.15600-39t00§ Grade 02 (Deputy Commandant) Pay Rs. 6600/
Assistant Commandant PB-3(Rs.15600-39100) plus 02
Detailed Advertisement containing Application Form, Eligibility Conditions,
Method and Modalities of recruitment, Aircraft-wise/Streamuwise vacancies and Vacancy Updation Chart is available on BSF website www.bsf.nic.in. which can be seen/downloaded.
In addition to the usual Central Gowrnment Pay & Allowances. the Officers in BSF Air Wing are entitled to special Incentives and Deputation Allowance as per following rates:
he Advertisement is open for one year subject to availability of vacancies as per the requirement. Eligible candidates may apply up to one year from the date of publication of this Advertisement in the Employment News. Last date for receipt of applications will be the last working day of the 22“ month from the date of publication of the advertisement in the Employment News. The Advertisement is subject to modification/cancellation as and when necessary. Vacancies and Eligibill‘ity Criteria are subject to change as per the requirement.
DisCount on Web Hosting
HI guys get 635 Rs. Discount on you webhosting and domain , please visit Here
Hostgator.com has been a world leading web hosting service provider since its establishment in the year 2002. Our current staff strength is more than 750 employees. With our office located in Houston, Texas, we are able to provide satisfying service to clients from over 200 countries internationally. However, with the aim of providing exceptional and localized service and support to our clients, we are expanding globally and have started with our Indian Operations asHostgator.in. We offer various packages such as Shared, Reseller, VPS, and Dedicated Servers for both the professionals as well as beginners. All our shared Web Hosting plans includes 24/7/365 support, along with a 99.9% uptime guarantee and a 45 day money back guarantee. To know more about us kindly visit our company page.
To get Discount Plzz mention this Coupon Code :-BestOfferCoupon25
To get Discount Plzz mention this Coupon Code :-BestOfferCoupon25
Operators in PHP
What is Operator? Simple answer can be given using expression 4 + 5 is equal to 9. Here 4 and 5 are called operands and + is called operator. PHP language supports following type of operators.
- Arithmetic Operators
- Comparision Operators
- Logical (or Relational) Operators
- Assignment Operators
- Conditional (or ternary) Operators
Lets have a look on all operators one by one.
Arithmatic Operators:
There are following arithmatic operators supported by PHP language:
Assume variable A holds 10 and variable B holds 20 then:
Operator | Description | Example |
---|---|---|
+ | Adds two operands | A + B will give 30 |
- | Subtracts second operand from the first | A - B will give -10 |
* | Multiply both operands | A * B will give 200 |
/ | Divide numerator by denumerator | B / A will give 2 |
% | Modulus Operator and remainder of after an integer division | B % A will give 0 |
++ | Increment operator, increases integer value by one | A++ will give 11 |
-- | Decrement operator, decreases integer value by one | A-- will give 9 |
Comparison Operators:
There are following comparison operators supported by PHP language
Assume variable A holds 10 and variable B holds 20 then:
Operator | Description | Example |
---|---|---|
== | Checks if the value of two operands are equal or not, if yes then condition becomes true. | (A == B) is not true. |
!= | Checks if the value of two operands are equal or not, if values are not equal then condition becomes true. | (A != B) is true. |
> | Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true. | (A > B) is not true. |
< | Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true. | (A < B) is true. |
>= | Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true. | (A >= B) is not true. |
<= | Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true. | (A <= B) is true. |
Logical Operators:
There are following logical operators supported by PHP language
Assume variable A holds 10 and variable B holds 20 then:
Operator | Description | Example |
---|---|---|
and | Called Logical AND operator. If both the operands are true then then condition becomes true. | (A and B) is true. |
or | Called Logical OR Operator. If any of the two operands are non zero then then condition becomes true. | (A or B) is true. |
&& | Called Logical AND operator. If both the operands are non zero then then condition becomes true. | (A && B) is true. |
|| | Called Logical OR Operator. If any of the two operands are non zero then then condition becomes true. | (A || B) is true. |
! | Called Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is true then Logical NOT operator will make false. | !(A && B) is false. |
Assignment Operators:
There are following assignment operators supported by PHP language:
Operator | Description | Example |
---|---|---|
= | Simple assignment operator, Assigns values from right side operands to left side operand | C = A + B will assigne value of A + B into C |
+= | Add AND assignment operator, It adds right operand to the left operand and assign the result to left operand | C += A is equivalent to C = C + A |
-= | Subtract AND assignment operator, It subtracts right operand from the left operand and assign the result to left operand | C -= A is equivalent to C = C - A |
*= | Multiply AND assignment operator, It multiplies right operand with the left operand and assign the result to left operand | C *= A is equivalent to C = C * A |
/= | Divide AND assignment operator, It divides left operand with the right operand and assign the result to left operand | C /= A is equivalent to C = C / A |
%= | Modulus AND assignment operator, It takes modulus using two operands and assign the result to left operand | C %= A is equivalent to C = C % A |
Conditional Operator
There is one more operator called conditional operator. This first evaluates an expression for a true or false value and then execute one of the two given statements depending upon the result of the evaluation. The conditional operator has this syntax:
Operator | Description | Example |
---|---|---|
? : | Conditional Expression | If Condition is true ? Then value X : Otherwise value Y |
Operators Categories:
All the operators we have discussed above can be categorised into following categories:
- Unary prefix operators, which precede a single operand.
- Binary operators, which take two operands and perform a variety of arithmetic and logical operations.
- The conditional operator (a ternary operator), which takes three operands and evaluates either the second or third expression, depending on the evaluation of the first expression.
- Assignment operators, which assign a value to a variable.
Precedence of PHP Operators:
Operator precedence determines the grouping of terms in an expression. This affects how an expression is evaluated. Certain operators have higher precedence than others; for example, the multiplication operator has higher precedence than the addition operator:
For example x = 7 + 3 * 2; Here x is assigned 13, not 20 because operator * has higher precedence than + so it first get multiplied with 3*2 and then adds into 7.
Here operators with the highest precedence appear at the top of the table, those with the lowest appear at the bottom. Within an expression, higher precedence operators will be evaluated first.
Category | Operator | Associativity |
---|---|---|
Unary | ! ++ -- | Right to left |
Multiplicative | * / % | Left to right |
Additive | + - | Left to right |
Relational | < <= > >= | Left to right |
Equality | == != | Left to right |
Logical AND | && | Left to right |
Logical OR | || | Left to right |
Conditional | ?: | Right to left |
Assignment | = += -= *= /= %= | Right to left |
PHP is case sensitive
PHP is case sensitive
Yeah it is true that PHP is a case sensitive language. Try out following example:
<html>
<body>
<?
$capital = 67;
print("Variable capital is $capital<br>");
print("Variable CaPiTaL is $CaPiTaL<br>");
?>
</body>
</html>
This will produce following result:
Variable capital is 67
Variable CaPiTaL is
Yeah it is true that PHP is a case sensitive language. Try out following example:
<html>
<body>
<?
$capital = 67;
print("Variable capital is $capital<br>");
print("Variable CaPiTaL is $CaPiTaL<br>");
?>
</body>
</html>
This will produce following result:
Variable capital is 67
Variable CaPiTaL is
PHP is whitespace insensitive
PHP is whitespace insensitive
Whitespace is the stuff you type that is typically invisible on the screen, including spaces, tabs, and carriage returns (end-of-line characters).
PHP whitespace insensitive means that it almost never matters how many whitespace characters you have in a row.one whitespace character is the same as many such characters
For example, each of the following PHP statements that assigns the sum of 2 + 2 to the variable $four is equivalent:
$four = 2 + 2; // single spaces
$four <tab>=<tab2<tab>+<tab>2 ; // spaces and tabs
$four =
2+
2; // multiple lines
Whitespace is the stuff you type that is typically invisible on the screen, including spaces, tabs, and carriage returns (end-of-line characters).
PHP whitespace insensitive means that it almost never matters how many whitespace characters you have in a row.one whitespace character is the same as many such characters
For example, each of the following PHP statements that assigns the sum of 2 + 2 to the variable $four is equivalent:
$four = 2 + 2; // single spaces
$four <tab>=<tab2<tab>+<tab>2 ; // spaces and tabs
$four =
2+
2; // multiple lines
"Hello World" Script in PHP
"Hello World" Script in PHP
To get a feel for PHP, first start with simple PHP scripts. Since "Hello, World!" is an essential example, first we will create a friendly little "Hello, World!" script.
As mentioned earlier, PHP is embedded in HTML. That means that in amongst your normal HTML (or XHTML if you're cutting-edge) you'll have PHP statements like this:
<html>
<head>
<title>Hello World</title>
<body>
<?php echo "Hello, World!";?>
</body>
</html>
It will produce following result:
Hello, World!
Wednesday 9 April 2014
Java program to convert Fahrenheit to Celsius
Java program to convert Fahrenheit to Celsius Java program to convert Fahrenheit to Celsius: This code does temperature conversion from Fahrenheit scale to Celsius scale.
Java programming code
import java.util.*; class FahrenheitToCelsius { public static void main(String[] args) { float temperatue; Scanner in = new Scanner(System.in); System.out.println("Enter temperatue in Fahrenheit"); temperatue = in.nextInt(); temperatue = (temperatue - 32)*5/9; System.out.println("Temperatue in Celsius = " + temperatue); } }
Reverse string using StringBuffer class
Reverse string using StringBuffer class
class InvertString { public static void main(String args[]) { StringBuffer a = new StringBuffer("Java programming is fun"); System.out.println(a.reverse()); } }
StringBuffer class contains a method reverse which can be used to reverse or invert an object of this class.
Subscribe to:
Posts (Atom)
Comment
Comment Box is loading comments...