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;
while(scanf("%d" ,&a)!=EOF)
{
if(a==0)
printf("vai ter copa!\n");
else if(a>0)
printf("vai ter duas!\n");
}
return 0;
}
If I write the code in c++,then it will show error.
ReplyDeleteI have written (cin>>a) replacing scanf("%d" ,&a).
Please give the solution of it Sir.
#include
Deleteusing namespace std;
int main()
{
int n;
while(cin>>n)
{
if(n>0)
{
cout<<"vai ter duas!\n";
}
else
{
cout<<"vai ter copa!\n";
}
}
return 0;
}
Thank you!
ReplyDelete