2 years later
1 month later
Hey guys,
I am particularly new to coding I tried with C while giving a solution to this problem but I'm always getting an SIGSEGV error
Pleas Help!!
Here is my code
#include <stdio.h>
int main() {
int a[20], x, count=0;
do{
scanf("%d\n", &x);
a[count]=x;
count++;
}while(x!=42);
x=0;
for(x; x<count-1; x++){
printf("%d\n", a[x]);
}
return 0;
}
9 months later
is there any problem with this code.??it gives the output but still its showing error.
#include<stdio.h>
int main()
{
int i,n,j;
int ch[5];
scanf("%d",&n);
for(j=0;j<n;j++)
{
scanf("%d",&ch[j]);
}
for(i=0;i<n;i++)
{
if(ch[i]<ch[i+1])
printf("\n%d",ch[i]);
else
break;
}
if(ch[i]>ch[i+1])
printf("\n%d",ch[i]);
return 0;
}
8 months later