# Month: September 2010

## C Program 2 – Electricity Bill calculation

This program is to display the electricity bill calculation based on the number of units consumed every month Input : the number of units – variable name – unit Output – Amount of rupee – variable name – amount Logic: Units Rupees 1-50 units 0.75/unit 51-100 0.85/unit 101-200 1.50/unit 201-300 2.20/unit >300 3.00/unit In all …

## C Program 1 – To find the reversal of a given number

Assume the number 1234, after reversal the number becomes 4321. Input: One number, Ex 1234, declared to num Output : One number, Ex 4321, rev is the variable Logic: separate each digit using modulo operator from the right and bring that number to front divide the given number by 10, so the right most digit …

## Decision Making and Looping

C supports Decision Making and Looping (Interations) In decision Making, if, if-else, if- else if – else, switch – case is used. if(condition) { //These statements are executed only if the condition is true or 1 } if – else if(condition) { //These statements are executed only if the condition is true or 1 } …

## Data types

Declaration of variable names does two things it tells the compiler what the variable name is specifies what type of data the variable will hold So it is mandatory that each variable should belong to a particular data type. C supports different data types like integer, character, float, double, etc. Data type Size on a …

## Tokens in C

Tokens are classified as Keywords Identifiers Operators Constants Special Symbols Keywords Keywords are reserved by the compilers and keywords will not be redefined (means the keywords are not been declared as variable names, etc). There are standard 32 keywords in C compiler, and some compilers uses more keywords based on their specification. Here is the …

## printf() and scanf() Functions

Printf() is a function to print strings to the display unit and scanf() is to scan the input through the keyboard the f in the printf and scanf are called as format. That is, printf() and scanf() will print and scan in some particular format, it is the duty of the developer to provide that …

## Sample C Program

/* This program is written by T S Pradeep Kumar on 28th Sep 2010 This is to display Hello World to the display unit */ #include <stdio.h> //including the standard IO functions like printf(), scanf() int main() { printf(“Hello World n”); return 0; } stdio.h is the library which contains the printf(), scanf() and other …

## Introduction to C Programming

Features of C Programming C is a small language having lesser number of keywords than Java or pascal. C is a native language of Unix, Linux. Not only that many of the windows packages, database programs, graphics libraries are written in C program C is portable – it provides standard set of libraries that work …

## Xgraph [dialog.o] error

If you are installing ns2 allinone package in fedora or ubuntu or any other linux, all the packages will be installed successfully. Occasionally the recent releases of linux flavors failed to install xgraph. Problem: The possible error you may get is [dialog.o] error, Solution: Open the file dialog.c which is available under the folder xgraph-12.1/ …