Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just find out the logic. If you stuck in trouble, just inform me on comment.
/**Bismillahir Rahmanir Rahim.**/ #include <stdio.h> int main() { int a,b,c,d,e; scanf("%d", &a); for(b=0; b<a; b++) { scanf ("%d", &c); if(c>10) { d=c-10; e=10; printf("%d %d\n",d,e); } else { d=0; printf("%d %d\n",d,c); } } return 0; }
I don't understand this code
ReplyDeleteproblem,, Your code will produce a duplicate result
ReplyDeleteyour code will generate duplicate answer.
ReplyDeleteYeah felt that ❤
ReplyDelete#include
ReplyDelete#include
int main()
{
int tc,n,num,a,b;
scanf("%d",&n);
for(tc=1;tc<=n;tc++){
scanf("%d",&num);
label1:
int a =rand()%100;
int b =rand()%100;
while((a+b)!=num)
goto label1;
printf("Case %d: %d %d",tc,a,b);
}
return 0;
}
What is the problem in my code ??
#include
ReplyDelete#include
int main()
{
int tc,n,num,a,b;
scanf("%d",&n);
for(tc=1;tc<=n;tc++){
scanf("%d",&num);
label1:
int a =rand()%100;
int b =rand()%100;
while((a+b)!=num)
goto label1;
printf("Case %d: %d %d",tc,a,b);
}
return 0;
}
What is the problem in my code ??