0% found this document useful (0 votes)
51 views

Assignment 6

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views

Assignment 6

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Assignment 6

(1) Write a C function to return the index of LAST occurrence of a


number in a given array. Array index start from 0. If the item is
not in the list return -1.

(2) Write a C function to return the maximum and minimum number


in an array and their indexes.

(3) Write a C function to return the sum of an array which is the


sum of its individual elements. For example, if an array is
numbers = {1, 2, 3, 4}, the sum of the array is 1+2+3+4 = 10.

(4) Write a function which, given a string, return TRUE if all


characters are distinct and FALSE if any character is
repeated.

(5) Write a C function that return 0 if a given number is a


power of 3, otherwise return 1.

(6) Write a C function that take two numbers and return array
contain all numbers between the two given numbers.
(numbers 2,6->return array contain [3,4,5]).

(7) Write a C function to return the index of FIRST occurrence of a


number in a given array. Array index start from 0. If the item is
not in the list return -1.
(8) Write a C function to return the index of LAST occurrence of a
number in a given array. Array index start from 0. If the item is
not in the list return -1.

(9) Write a C function to take 2 arrays and swap them (try with
2 different sizes).

(10) Write a C function that return the count of the longest


consecutive occurrence of a given number in an array.
Array= {1,2,2,3,3,3,3,4,4,4,4,3,3,3} and searching for 3 ->
result = 4.

(11) Write a program that computes the nth term of the arithmetic
series: 1, 3, 5, 7, 9, … Run the program to compute the 100th
term of the given series.

(12) Write a function to remove all characters in a string expect


alphabet.

(13) Write a function which, given a string, converts all uppercase


letters to lowercase, leaving the others unchanged.

(14) Write a C function that return the count of the longest


consecutive occurrence of any number ,and return the
number Array={1,2,2,3,3,3,3,4,4,4,4,4,3,3,3} result -> 5
,number -> 4.

(15) Write a c function that removes the repeated number


of an input sorted array and return a new array without the
repeated numbers.
(16) Write c function to take an array (with unknown size)
contain 2 zeros swap the 3 element after the first zero with the 3
element after the second zero ( x,x,x,0,1,2,3,xxxx,0,5,6,7,xxxx -
>swap 1,2,3with 5,6,7).

(17) Write c function to take an array and return the biggest


difference between 2 numbers in the array (the smaller number
must come first in the array) {10,1,5,3,6,8,7,2}->return 7
difference between 1,8.

(18) Write a C Function that swaps two pointers.

(19) Write a C function to take 10 mono numbers (from 0to


9) from user and return the most repeated one, if user enter
number bigger than 9 return -1(don’t use arrays).

(20) Write a C Function that prints the cube of any number.

(21) Write a C Function that takes one character and checks if it


alphabet or not (using generic pointer ).

(22) Write a C function to check if the input is an even number or


an oddnumber, if even number return 0 if odd number return
1.
Example:
Input 9, Output = 1 (Odd)
Input 4, Output = 0 (Even)
(23) Write C Function that converts the any letter from
lowercase touppercase (using bitwise).

(24) Write c function to check if string is mirror or not


"SalaS","SalelaS".

(25) Given a string and a number N, we need to mirror the


characters from N-th position up to the length of the string in
the alphabetical order. In mirror operation, we change ‘a’ to
‘z’, ‘b’ to ‘y’, and so on.
Examples:
Input : N = 3
paradox
Output : paizwlc
We mirror characters from position 3 to end.

Input : N = 6
pneumonia
Output : pnefnlmrz

(26) Write c function to reverse words in sentence (without using


external arrays)" I work as an embedded software engineer for 3
years"-> " years 3 for engineer software embedded an as work I".
(27) Write a function to reverse a string by passing it to a function.

(28) Write a C Program for swapping two arrays “A & B” with


different lengths. B will be always the smallest array.
int * Swap (int a_size,int *a,int b_size,int *b)
(29) Write a C function that compare between 2 arrays with the
same length. It shall return 0 if the two arrays are identical and
1 if not (using two pointer technique).

(30) Write a C Function that reads two integers and checks if


the first ismultiple of the second.

(31) Write a c function that convert ascii to float


examples: 1) 12.34 <- “12.43”
2) .0e+5 <- “.0e+5” 3) -6.4E <- “-6.4E+2”.

(32) Write a C code to take string “morgan,5,memo,10” and print


the first word number of times as the first number ,and second
word as the second number .

(33) Given two floating number A and B: Find the value of A xor
B(using pointer).

You might also like