Decision Statement in C

Decision Statement (if statement) /* Author : ITVoyagers (https://itvoyagers.in/) Date :25th December 2018 Description : Decision Statement (if statement). */ #include<stdio.h> void main() { int a; printf(“Enter a number: “); scanf(“%d”,&a); if(a>0) { printf(“It is positive number”); } } Output: Enter a number: 5 It is positive number Decision Statement (if-else statement) /* Author : … Read more

Iterator and Iterables in Python

iterator (itvoyagers.in)

Iterator and Iterables in Python We can use iterators and iterable using for loop,genators etc.Iterators are objects used to travesrse using loop.We can build our own iterators using __iter__ and __next__.Topics to cover in this post: What are iterators and iterables in Python? Iterating using iterator in python & user defined Iterators Iterators in for … Read more

Directory in Python and its methods

directory (itvoyagers.in)

Directory in Python and its methods Directories Directories are holding all python files and directories.To manipulate this directories OS Module needs to be imported.This module consists of many methods to handle directories. List of some directory functions: getcwd() mkdir() chdir() rmdir() listdir() rename() getcwd(): This method is used to show Current Working Directory. To use … Read more

Remaining file methods in Python

file methods (itvoyagers.in)

File methods Summarizing file methods: open() close() read() write() rename() remove() Among the above methods we have already explained open() ,read(),write() and close() in previous posts. Now we will explain remove and rename methods of file object. rename(): This method is used for renaming existing file.To use this method it is important to import os … Read more

How to read, write and append in a file using Python?

read (itvoyagers.in)

Read, Write and Append in a file using Python Reading & Writing in files The user must open a file first using open() to read it.The reading of string always starts with beginning of the file. Methods to perform read operation read() ,readline() & readlines() read() : This method is used to read entire size … Read more

Programs on Operators and Expressions in C

/* Author : ITVoyagers (https://itvoyagers.in/) Date :25th December 2018 Description : Programs on Operators and Expressions. */ #include<stdio.h> #include<conio.h> void main() { int a=5,b=3,*p; p=&a; clrscr(); /************ Unary Operators ***********/ printf(“\nUnary Operators\nOperators that operates or works with a single operand are unary operators. For example: (++ , –)\n”); printf(“\nBitwise Complement ~a=%d”,~a); printf(“\nUnary Minus -a=%d”,-a); printf(“\nPointer … Read more

Programs to understand the basic data types and I/O in C.

basic.c /* Author : ITVoyagers (https://itvoyagers.in/) Date :25th December 2018 Description : Programs to understand the basic data types and I/O. */ #include<stdio.h> void main() { int i; char c; float f; double d; char s[10]; //string /********* Printing size of Datatypes **********/ printf(“size of number: %d \n”,sizeof(int)); printf(“size of character: %d \n”,sizeof(char)); printf(“size of … Read more