C programming examples with output Part - 2 - Ishwaranand

News

C programming examples with output Part - 2

Program

c program examples, c programming examples with output, basic programs in c, c programs for practice, c language basics, c programs for interview, c programming questions, c programming tutorial, c program examples, basic programs in c, c programming software, c programming tutorial, c programs for practice, c programs with solutions, c program online compiler, c program examples, c program to add two numbers, c program compiler, c program to find factorial of a number, c program to reverse a number, c program to reverse a string, c program for prime number, structure of c program, hello world c program, leap year c program, bubble sort in c program, merge sort in c program, quick sort in c program,
C programming examples with output Part - 2 ~ Image by ©Ishwaranand


1) What is the output of the following program?  if the user inputs the values as 9876545623

void main()
{
        int a,b,c:
        scanf ("%1d %2d %d", &a, &b, &c);
        printf ("sum=%d", a+b+c);
}
Output:
987654  564 23
sum=750

2) What is the output of the following program?

 # include<stdio.h>
void main()
        int i=15, j=4, m, n;

        m= i>9;
        n= j>4 && j!=2;

        printf("m=%d n=%d", m, n);
}

Output:
m = 1 n = 0

3) What is the output of the following program?

 #include <stdio.h>
void main()
        int x=5, m, k=1, n;
        float y=2.5;

        m=x*1000 + y*10;
        k=m/1000 +x;
        n=(x==y) ?k:m;

        printf("%d /n%d", m, k, n);
}

Output:
5025
10
5025

4) What is the output of the following program? - Cube Equation

#define CUBE(X) (X*X*c)
void main()
{
         printf ("%d", CUBS);
}

Output:
49

No comments

Comment on Ishwaranand or Happy Day
Not, Add any types of links