1. Write a C program to check whether a number is even or odd.
[Link] a program to find the largest of three numbers.
[Link] the sum of digits of a given number.
1. Write a program to check whether a character is a vowel or consonant.
2. Convert temperature from Celsius to Fahrenheit.
3. Find factorial of a number (using loop).
4. Generate Fibonacci series up to n terms.
5. Reverse a given number (e.g., 123 → 321).
6. Check whether a number is prime.
Intermediate Level (Arrays, Strings, Functions)
[Link] a function to find the maximum and minimum elements in an array.
[Link] an array using Bubble Sort.
[Link] an array without using another array.
[Link] two arrays into a single sorted array.
[Link] the frequency of each element in an array.
[Link] the second largest element in an array.
[Link] duplicates from a sorted array.
[Link] a program to count vowels, consonants, digits, and spaces in a string.
[Link] a string without using library functions.
[Link] if a string is a palindrome.
Advanced Level (Pointers, Bitwise, Recursion)
[Link] your own version of strlen() using pointers.
[Link] two variables using pointers (no third variable).
[Link] a recursive function to calculate factorial.
[Link] a recursive function for Fibonacci numbers.
[Link] bitwise operators to:
• Check if a number is power of 2.
• Count number of set bits (1’s) in an integer.
[Link] a stack using arrays.
[Link] a queue using arrays.
[Link] a program to dynamically allocate an array using malloc, take input, and calculate
average.
[Link] a function to reverse a linked list.
[Link] a program to implement binary search using recursion.
[Link] IS EVEN OR ODD
even_odd.s
.global _start
.section .data
even: .asciz "Number is even\n"
odd: .asciz "Number is odd\n"
.section .text
_start:
mov x1,#132
and x3,x1,#1
cmp x3,#1
beq odd_lab
b even_lab
even_lab:
mov x0,#1
ldr x1,=even
mov x2,#15
mov x8,#64
svc #0
odd_lab:
mov x0,#1
ldr x1,=odd
mov x2,#14
mov x8,#64
svc #0
exit:
mov x0,#0
mov x8,#93
svc #0
[Link] a program to find the largest of three numbers.
.global _start
.section .data
msg1: .asciz "x1 is the largest number\n"
msg2: .asciz "x2 is the largest number\n"
msg3: .asciz "x3 is the largest number\n"
.section .text
_start:
mov x1,#123
mov x2,#258
mov x3,#43
cmp x1,x2
bgt first_lable
b sec_lable
first_lable:
cmp x1,x3
bgt x1_largest
b x3_largest
sec_lable:
cmp x2,x3
bgt x2_largest
b x3_largest
x1_largest:
mov x0,#1
mov x4,x1
ldr x1,=msg1
mov x2,#25
mov x8,#64
svc #0
b exit
x2_largest:
mov x0,#1
mov x4,x2
ldr x1,=msg2
mov x2,#25
mov x8,#64
svc #0
b exit
x3_largest:
mov x0,#1
mov x4,x3
ldr x1,=msg3
mov x2,#25
mov x8,#64
svc #0
b exit
exit:
mov x0,x4
mov x8,#93
svc #0
[Link] the sum of digits of a given number
.global _start
.section .data
msg: .asciz "Sum: "
newline: .asciz "\n"
buf: .space 20
.section .text
_start:
mov x1, #123
mov x2, #0
loop:
cbz x1, print
mov x4, #10
udiv x3, x1, x4
msub x4, x3, x4, x1
add x2, x2, x4
mov x1, x3
b loop
print:
mov x0, #1
ldr x1, =msg
mov x2, #5
mov x8, #64
svc #0
ldr x5, =buf
mov x6, x5
add x5, x5, #19
mov x7, #0
itoa_loop:
mov x4, #10
udiv x3, x2, x4
msub x9, x3, x4, x2
add x9, x9, #'0'
strb w9, [x5], #-1
add x7, x7, #1
mov x2, x3
cbnz x2, itoa_loop
add x5, x5, #1
mov x0, #1
mov x1, x5
mov x2, x7
mov x8, #64
svc #0
mov x0, #1
ldr x1, =newline
mov x2, #1
mov x8, #64
svc #0
mov x8, #93
mov x0, #0
svc #0
4. Read char from user and check whether a character is a vowel or consonant.
.global _start
.section .data
char: .asciz "aeiou"
vow: .asciz "vowel\n"
con: .asciz "consonent\n"
msg: .asciz "Enter a character : "
buffer: .skip 2
.section .text
_start:
mov x0,#1
ldr x1,=msg
mov x2,#20
mov x8,#64
svc #0
mov x0,#0
ldr x1,=buffer
mov x2,#2
mov x8,#63
svc #0
ldr x1,=buffer
ldrb w1,[x1]
ldr x2,=char
loop:
ldrb w4,[x2]
cbz w4,consonent
cmp w4,w1
beq vowel
add x2,x2,#1
b loop
vowel:
mov x0,#1
ldr x1,=vow
mov x2,#6
mov x8,#64
svc #0
b exit
consonent:
mov x0,#1
ldr x1,=con
mov x2,#10
mov x8,#64
svc #0
b exit
exit:
mov x0,#0
mov x8,#93
svc #0
op :
Enter a character : e
vowel