answersLogoWhite

0

I

User Avatar

Crumble Jared

Lvl 2
4y ago

What else can I help you with?

Continue Learning about Engineering

How do you print the middle number of a 3digit number using c?

it is int n=123; printf ("%d", (n/10)%10);


Write a c program to find positive and negative count?

# include # include void main(){int a[20], i, n ;clrscr() ;printf("Enter the limit : ") ;scanf("%d", &n) ;printf("Enter the elements") ;for(i = 0 ; i < =n ; i++)scanf("%d", &a[i]) ;printf("The positive elements are") ;printf("the negative elements are);for(i = 0 ; i < n ; i++){if(a[i] > 0)printf("%d", a[i]) ;if(a[i]


Write a c program for binary searching?

/* C program for binary search: This code implements binary search in */ /* C language. It can only be used for sorted arrays, but it's fast as */ /* compared to linear search. If you wish to use binary search on an */ /* array which is not sorted then you must sort it using some sorting */ /* technique say merge sort and then use binary search algorithm to */ /* find the desired element in the list. If the element to be searched */ /* is found then its position is printed. */ #include&lt;stdio.h&gt; main() { int c, first, last, middle, n, search, array[100]; printf("Enter number of elements\n"); scanf("%d",&amp;n); printf("Enter %d integers\n", n); for ( c = 0 ; c &lt; n ; c++ ) scanf("%d",&amp;array[c]); printf("Enter value to find\n"); scanf("%d",&amp;search); first = 0; last = n - 1; middle = (first+last)/2; while( first &lt;= last ) { if ( array[middle] &lt; search ) first = middle + 1; else if ( array[middle] == search ) { printf("%d found at location %d.\n", search, middle+1); break; } else last = middle - 1; middle = (first + last)/2; } if ( first &gt; last ) printf("Not found! %d is not present in the list.\n", search); return 0; }


How do you get the middle number for the turbo c using array?

it depends how you have coded your program as: if you initialized your array (a) by loop from 0 then int lb=0,ub=n-1; //n is number of elements in array int mid=(lb+ub)/2; printf("middle number is :%d",a[mid]); if you initialized your array (a) by loop from 1 then int lb=1,ub=n; //n is number of elements in array int mid=(lb+ub)/2; printf("middle number is :%d",a[mid]);


C program to print helical matrix?

//the following code will help you to write the program for(i=n-1, j=0; i &gt; 0; i--, j++) //n is the order of the square matrix { for(k=j; k &lt; i; k++) printf("%d ", a[j][k]); for(k=j; k &lt; i; k++) printf("%d ", a[k][i]); for(k=i; k &gt; j; k--) printf("%d ", a[i][k]); for(k=i; k &gt; j; k--) printf("%d ", a[k][j]); } m= (n-1)/2; //calculate the position of the middle element if (n% 2 == 1) printf("%d", a[m][m]);//to print the middle element also //9809752937(udanesh)

Related Questions

What is the middle letter of the alphabet?

k is the middle number n is the letter in the middle of the alphabet. M and N together are the middle of the alphabet. There are 26 letters; M is the 13th so it ends the first half, and N begins the second half.


What is the 4th letter in the alphabet?

The 14th letter of the modern Greek alphabet is xi. It is written uppercase &Xi;, lowercase &xi; , and the Greek name for the letter is &xi;&iota;.


Which alphabet is in a geometry box?

D( Protractor)


What is the middle letter in the alphabet?

There are 26 letters, so there is no exact "halfway". M and N are 13th and 14th, splitting the halfway point.


Which two letters are right in the middle of the alphabet?

alpHAbet


What letter in the English alphabet is after 'N'?

The alphabet has 26 letters. The letter "O" comes after the letter "N".The English alphabet, in order:ABCDEFGHIJKLMNOPQRSTUVWXYZ


What are the d?

"d" or "D" is a letter of the alphabet.


What is the frequency of the letters of the alphabet in Indonesian?

1 a 1 d 1 e 2 i 3 n 1 o


Are ñ and ng part of the english alphabet?

No. There is only a plain n and a g, both singly. There are no combinations of letters in the English alphabet. a, b, c. d. e. f. g. h. i. j, k, l, m, n, o ...


What letter in the English alphabet is after 'd'?

The alphabet has 26 letters. The letter "E" comes after the letter "D".The English alphabet, in order:ABCDEFGHIJKLMNOPQRSTUVWXYZ


How many such pairs of letters are there in the word FOREIGN each of which has as many letters between them in the word as they have in the English alphabet?

The answer is three.g, and the second a. (5 letters between them, in the word and in the alphabet)g, n. (6 letters between them, in the word and in the alphabet)r, n. (3 letters between them, in the word and in the alphabet)


What is the 14 letter in the alphabet?

In English 'M' - In Greek 'N' (nu)