Friday, August 31, 2018

Predict output 4 - Answer


Output of following C Programs are not very simple. These are simple but very interesting top c programs asked during viva and interviews.

Predict output of following C Programs:


Program-1

int main()
{
  printf("Hello\\rStudents");
  return 0;
}

Output: Hello\rStudents
Justification: "\" can be printed using "\\" in printf();

Program-2

int main()
{
  printf("12345\r67890");
  return 0;
}

Output: 67890 
Justification: "\r" is a carriage return character; which reset the cursor position to the starting point of current line; hence 12345 printed will be replaced by 67890.

Program-3

int main()
{
  printf("12345678\r000");
  return 0;
}

Output: 00045678
Justification: "\r" is a carriage return character; which reset the cursor position to the starting point of current line; hence 123 will be replaced by 000 keeping remaining character as it is.

Program-4

int main()
{
  printf("123\\\\456");
  return 0;
}

Output: 123\\456
Justification: "\\" in a printf() will print "\"; hence "\\\\" will become "\\" in output.

Program-5

int main()
{
  float n1, n2, total;
  n1 = 5.45;
  n2 = 6.54;
  total = n1 + n2;
  printf("%f", total);
  return 0;
}

Output: 11.990000
Justification: By default floating point numbers are printed with six decimal points precision(after ".")





Monday, August 27, 2018

Predict C Program output - 4


Output of following C Programs are not very simple. These are simple but very interesting top c programs asked during viva and interviews.

Predict output of following C Programs:

Program-1

int main()
{
  printf("Hello\\rStudents");
  return 0;
}

Program-2

int main()
{
  printf("12345\r67890");
  return 0;
}

Program-3

int main()
{
  printf("12345678\r000");
  return 0;
}

Program-4

int main()
{
  printf("123\\\\456");
  return 0;
}

Program-5

int main()
{
  float n1, n2, total;
  n1 = 5.45;
  n2 = 6.54;
  total = n1 + n2;
  printf("%f", total);
  return 0;
}

Answer will be uploaded soon...


Saturday, August 25, 2018

Predict C Program Output-3 Answer


Program-1

#include<stdio.h>
int main()
{
  float num=65;
  printf("Size of(num) = %d",printf("65"));
  return 0;
}

Output: 65Size of(num) = 2

Justification: printf("65") written inside will be executed first; hence it prints 65. Also it returns 2 as two characters are printed, which will be printed as a value of %d.


* * * * *
Program-2

#include<stdio.h>
int main()
{
  int number = 97 ;
  printf("%c",number);
  return 0;
}

Output: a

Justification: 'a'  is the corresponding character of ASCII value 97; hence output is a.

* * * * *
Program-3

#include<stdio.h>
int main()
{
  char ch = '0' ;
  printf("%d", ch);
  return 0;
}

Output: 48

Justification: '48'  is the corresponding ASCII value of character '0' (Zero); and format specifier is %d hence output is 48.

* * * * *

Program-4

#include<stdio.h>
int main()
{
  char ch = 0 ;
  printf("%d", ch);
  return 0;
}

Output: 0

Justification: is assigned as a number zero to ch; and format specifier is %d hence output is 0.

* * * * *

Program-5

#include<stdio.h>
#define int char
int main()
{
  int num=65;
  printf("Size of(num) = %d",sizeof(num));
  return 0;
}

Output: Size of(num) = 1

Justification: #define replaces int with char; hence num will be declared as char type variable; hence output is Size of(num) = 1.


Friday, August 24, 2018

Predict C Program Output - 3


Predict the output of following C Programs.

Program-1

#include<stdio.h>
int main()
{
  float num=65;
  printf("Size of(num) = %d",printf("65"));
  return 0;
}


* * * * *
Program-2

#include<stdio.h>
int main()
{
  int number = 97 ;
  printf("%c",number);
  return 0;
}


* * * * *
Program-3

#include<stdio.h>
int main()
{
  char ch = '0' ;
  printf("%d", ch);
  return 0;
}


* * * * *

Program-4

#include<stdio.h>
int main()
{
  char ch = 0 ;
  printf("%d", ch);
  return 0;
}


* * * * *

Program-5

#include<stdio.h>
#define int char
int main()
{
  int num=65;
  printf("Size of(num) = %d",sizeof(num));
  return 0;
}


Check your Answer here...



Tuesday, August 14, 2018

Flowchart to check odd even number using Raptor


Odd Even Flowchart using RAPTOR

Raptor is one of the top flowcharts drawing tool. [ Click here to know more about RAPTOR ].

Following is the flowchart to check odd even number drawn in RAPTOR.

Fig. Odd Even Flowchart in RAPTOR

One of the great feature of RAPTOR is you can run/execute your flowchart.

When you run this flowchart in RAPTOR, it will ask you to enter a number; if we enter 5; it will display "It's Odd Number" as output.

Check more operation flowchart on following link:



Friday, August 3, 2018

Flowchart to Print Table of 5


RAPTOR Flowchart to print Table of 5

RAPTOR Flowchart to print Table of 5
Figure: RAPTOR Flowchart to Print Table of 5
Output of the Flowchart under RAPTOR is as under:

Figure: Output - Flowchart of Table of 5 in RAPTOR