Q1/Consider the C-programs below to determine the following requirements : 1- Write a brief description for each code line of the programs below?2- Determine the output of the programs?3- Suggest question statement for the programs?4- Fill the blanks in the code assigned withblank1, blank2, blank3, blank4?
#include int main(){ int i,n,a[100],SW,flag=0; printf("Enter the number of elements:\n") ; scanf("%d",&n) ; printf("Enter the elements\n") ; for(i=0;i<> { scanf("%d",&a[i]) ; } printf("Enter the element to be …blank1…..\n"); scanf("%d",&SW); /*Perform…blank2…. operation*/ for(i=0;i<> { if(a[i]==SW) { printf("Element %d …blank3… at %d position \n",SW,i); flag=1; break; } } if(flag==0) { printf("Element %d … blank4…….\n",SW); }}
int main()
{
int i,n,a[100],SW,flag=0;
printf("Enter the number of elements:\n") ;
scanf("%d",&n) ;
printf("Enter the elements\n") ;
for(i=0;i<>
scanf("%d",&a[i]) ;
}
printf("Enter the element to be …blank1…..\n");
scanf("%d",&SW);
/*Perform…blank2…. operation*/
if(a[i]==SW)
printf("Element %d …blank3… at %d position \n",SW,i);
flag=1;
break;
if(flag==0)
printf("Element %d … blank4…….\n",SW);
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here