Q/ Consider the C-programs below to determine the following requirements: 1- Write a brief description for each code line of the programs below? 2- Fill the blanks in the code assigned with blank1, 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
Q/
Consider the C-
1- Write a brief description for each code line of the programs below?
2- Fill the blanks in the code assigned with blank1, blank2, blank3, blank4?
#include<stdio.h>
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<n;i++)
{
scanf("%d",&a[i]) ;
}
printf("Enter the element to be …blank1…..\n");
scanf("%d",&SW);
/*Perform…blank2…. operation*/
for(i=0;i<n;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);
}
}
Step by step
Solved in 2 steps