first program dnt know how to solve but i tried please tell me the mistakes
u must be using turbo c++ compiler.
Use gcc.
U can use DevC++ or gcc using mingw or visual studio c++.
read this.
Let’s look at the problems.
First, don’t use <conio.h>
as it is not supported on online judges. So remove it and the getch()
.
Next, you have
printf("enter the number %d",&i);
printf("the number %d is "&i);
printf("exit");
No need for that “enter the number”, "the number is " and “exit” statement. Your output should match the format of the output given in the problem page. So remove those unnecessary statements.
Online judge - read this link.
How your program should be—
In the question see the input section, you just need to enter those input in the given format. And for those input your program needs to prints the expected output in the required format.
Just before you submit your program test your program here to avoid compile time errors.
Also don’t use conio.h and getch() in your program and unnecessary printf statements as mentioned in the above comments.
please tell me the tips to improve my coding
my code for easy program is
#include<stdio.h>
#include<conio.h>
int main()
{
int i;
printf(“enter the number %d”,&i);
scanf("%d",&i);
if(i!=42 && i!>=99)
{
printf("the number %d is "&i);
}
else
{
printf(“exit”);
}
getch();
return 0;
}
/that is c rigth?/
#include<stdio.h>
#include<conio.h>
int main(){
int i;
printf(“enter the number %d”,i);
scanf("%d",&i);
if(i != 42 && i <= 99){
printf("the number %d is ",i);
}else{
printf(“exit”);
}
getch();
return 0;
}
/some online compilers can give you a error/