Tuesday, May 23, 2017

Predict C Program Output - 2



Predict the output of following C programs.

Program-1
#include<stdio.h>
int main()
{
 printf("Hello");
 printf("\rIndia");
 return 0;
}

Program-2
#include<stdio.h>
int main()
{
  int number = - -5;
  printf("number = %d",number);
  return 0;
}

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

Program-4
#include<stdio.h>
enum colors {RED, BLUE, GREEN};
int main()
{
  printf("%d, %d, %d",BLUE, RED, GREEN);
  return 0;
}

Program-5
#include<stdio.h>
void display(void);
int main()
{
  int i=1;
  for(i=0; i<=5; i++)
  {
       printf("%d",i);
       if (i>2)
             goto ABC;
  }
}
display()
{
  ABC:
  printf("Hello World");

No comments:

Post a Comment