#include
int main(){
int i;
for(;std::cin>>i;)
{
if(i!=42)
std::cout<<i;
else
break;
}
return 0;
}
This is my code and it doesn’t get accepted, though runs perfectly in my computer!
Whats the error in it?
#include
int main(){
int i;
for(;std::cin>>i;)
{
if(i!=42)
std::cout<<i;
else
break;
}
return 0;
}
This is my code and it doesn’t get accepted, though runs perfectly in my computer!
Whats the error in it?
Please put your code in proper blocks. The mistake is you need to put a new line character after each number.
std::cout<<i<<endl;
i create this code but it doesnt work
#include
int main ()
{
int a;
for(;(a<=99)&&(a>=-99);
){ printf(“enter number”);
scanf("%d",&a);
if ( a!= 42)
printf("%d",a);
else
break; };
return 0; }
;what is the problem?
i create this code but it doesnt work
#include
int main ()
{
int a;
for(;(a<=99)&&(a>=-99);
){ printf(“enter number”);
scanf("%d",&a);
if ( a!= 42)
printf("%d",a);
else
break; };
return 0; }
;what is the problem?
you don’t have to put check for a <=9 or so, also no need of printing statments like enter the number, Your output should exactly be in the format specified in the problem description.