Knowledge is the key to immortality
What will be the output of the following C codes
Prepared by Ratul Chakraborty - Assistant Professor - Statistics

What will be the output of the following C codes:

  1. #include <stdio.h>
    
    int main()
    {
    	int x=123;
    	int i={
    		printf("c" "++")
    	};
    	
    	for(x=0;x<=i;x++){
    		printf("%x ",x);
    	}
    	
    	return 0;
    }
  2. #include <stdio.h> 
    
    int main() 
    { 
    	int i; 
    
    	for(i=0; i<=5; i++) i = i+5;
    	
    	printf("%d", i);
    	return 0; 
    }
  3. #include <stdio.h> 
      
    int main() 
    { 
    	int a = 10; 
    	int b = 2; 
    	int c; 
      
    	c = (a & b); 
    	printf("c= %d", c); 
      
    	return 0; 
    }
  4. #include <stdio.h> 
      
    int main() 
    { 
    	int x[] = {10,20,30,40}; 
    	int i, m = 0, m2 = 0; 
      
    	for(i=0; i<4; i++) m += x[i];
    	m = m/4;
    	for(i=0; i<4; i++) m2 += (x[i] - m);
    
    	printf("%d", m2); 
      
    	return 0; 
    }

 

Copyright © 2018 - All Rights Reserved - www.mbbcollege.in