• edited by
856 views
1 1 vote
What is the output of the following program?

void main()

{

printf("%d",5%2);

printf("%d",-5%2);

printf("%d",5%-2);

printf("%d",-5%-2);

printf("%d",2%5);
}

A) 1,-1 -1 1 0

B)1 -1 1 -1 0

c)1 -1 -1 -1 0

d)1 -1 -1 1 2

Please log in or register to answer this question.

Position:
Show:

Related questions

7 7 votes
3 answers 3 answers
1.7k
1.7k views
Parshu gate asked Nov 20, 2017
1,731 views
What is the output of the following program?#include<stdio.h int main() { int array[]={10, 20, 30, 40}; printf(“%d”, -2[array]); return 0; }$-60$$-30$$60$Garbage value
2 2 votes
1 1 answer
1.5k
1.5k views
Akshay Nair asked Jan 29, 2018
1,504 views
Why printf("%d",5%-2); is 1, not -1.
0 0 votes
0 0 answers
1.2k
1.2k views
srestha asked Mar 7, 2018
1,207 views
#include<stdio.h int fun1(int x) { x=14; } int fun2(int x) { x=20; } int main() { int(*p)(),m,n; scanf("%d",&m); if(m) p=fun1; else p=fun2; n=(*p)(); printf("%d",n); retu...
0 0 votes
0 0 answers
685
685 views
srestha asked Mar 6, 2018
685 views
#include<stdio.h int main() { char a[]={'A','B','C','D'}; char *p=&a[0]; *p++; printf("%c%c",*++p, *p); }What will be the output?1)C B2)B B3)B A4)C A