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 N[10], temp,i,j;
for(i=0; i<10; i++)
scanf("%d",&N[i]);
for(i=0; i<10; i++)
{
if(N[i]<=0)
N[i]=1;
}
for(i=0; i<10; i++)
printf("X[%d] = %d\n",i,N[i]);
return 0;
}
why temp
ReplyDelete#include
ReplyDeleteint main()
{
int i;
float a[10];
for(i=0;i<10;i++)
{
scanf("%f",&a[i]);
}
for(i=0;i<10;i++)
{
if(a[i]<=0)
{
a[i]=1;
printf("X[%d] = %.0f\n",i,a[i]);
}
else
printf("X[%d] = %.0f\n",i,a[i]);
}
return 0;
}
reply....