Nested if else in C

C Programming Tutorial

It is perfectly all right if we write an entire if-else construct within either the body of the if statement or the body of an else statement. This is called ‘nesting’of ifs. Let’s have an example: /* A quick demo of nested if-else */ main( ) { int i ; printf ( “Enter either 1 … Read more

Changing a file’s Date Created and Last Modified attributes in linux

Linux yum

Easiest way – accessed modified will be the same: # touch -a -m -t 201512180130.09 fileName.txt Where: -a = accessed -m = modified -t = timestamp – use [[CC]YY]MMDDhhmm[.ss] time format If you wish to use NOW just drop the t and the timestamp You can add *.txt file to change the attributes of all … Read more

views changed into tables, while restoring mysql database

MySQL Cluster

  In the backup script the views are first created as tables which are then dropped at the end of the script as each view is being created, so it seems that an error occurs while creating the views at the end of the script. However when a view is created there is a user … Read more

Multiple Statements within if in C

C Programming Tutorial

It may so happen that in a program we want more than one statement to be executed if the expression following if is satisfied. If such multiple statements are to be executed then they must be placed within a pair of braces as illustrated in the below example. Example: The current year and the year in which … Read more

If Statement in C

C Programming Tutorial

Like most languages, C uses the keyword if to implement the decision control instruction. The general form of if statement looks like this: if ( this condition is true )       execute this statement ; The keyword if tells the compiler that what follows is a decision control instruction. The condition following the … Read more

Introduction to Decision Control Structure in C

C Programming Tutorial

Decision !!! we all need to alter our actions in the face of changing circumstances. If the weather is fine, then I will go for a stroll. If the highway is busy I would take a diversion. If the pitch takes spin, we would win the match. If she says no, I would look elsewhere. … Read more

write a C program to obtain the sum of the first and last digit of this number

C Programming Tutorial

Problem Statement: If a four-digit number is input through the keyboard, write a program to obtain the sum of the first and last digit of this number. Solution: /* Sum of 1st and last digit of a four digit number */ #include<stdio.h> #include<conio.h> main() { int n,a,sum=0; clrscr(); printf(“\Enter a four digit number”); scanf(“%d”,&n); a=n/1000; … Read more