Category Archives: Programming in C/C++

Kelvin to Celsius Conversion Table in C

%.2f means print as a floating point with 2 decimals.

The output is:
Kelvin to Celsius Conversion Table in C

REFERENCES

[1] Brian W. Kernighan, Dennis M. Ritchie, The C Programming Language (Second Edition), Prentice Hall Inc., Greek Edition, page. 28

www.ece.nu

The sizeof Operator in C

The sizeof operator is used to determine the number of bytes required to store a value of a specific data type.

The output is :

The sizeof operator in C

IDE: Xcode Version 6.1.1

Compiler: Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)

Operating system: OS X Yosemite Version 10.10.1 (64-bit kernel)

Processor: Intel Core 2 Duo (64-bit processor).

www.ece.nu

Pre-increment and post-increment operators in C

a++ post increment (it increments the value of a after the operation is over)

++b  pre increment (it increments the value of b before the operation)

The output is:

Pre-increment and post-increment operators in C

www.ece.nu

Computing and displaying the cubes and the sums of cubes of the first 10 integers in C

The above program computes and displays cubes and sums of cubes of the first 10 integers. This program also illustrates the use of while loop.
running_sum=running_sum+CUBE(i1)
e.g. for i1=1 the running_sum=0+1=1, for i2=2 the running_sum=1+8=9

The output is:

Computing and displaying cubes and sums of cubes of the first 10 integers in C

www.ece.nu

Operation with integers in C++

The output is x=2015 and y=2019.

www.ece.nu

Hello World! in C++

The above code can be run for example in Eclipse IDE for C/C++ Developers or Xcode.

www.ece.nu