1 C Program List
1 C Program List
and expressions.
Imp exam:
#include <stdio.h>
int main()
{
int a = 1;
printf("%d %d %d %d %d\n", a++, a++, a++,a++,a++);
a = 1;
printf("%d %d %d %d %d\n", a++, a++, a++,++a,a++);
a = 1;
printf("%d %d %d %d %d\n", a++, a++, ++a,++a,a++);
a = 1;
printf("%d %d %d %d %d\n", a++, ++a, ++a,++a,a++);
return 0;
}
Topic 3: Decision making(if, if-else, nested if-else), Control transfer(goto, break, continue) and
switch statements
#include <stdio.h>
#include <math.h>
int main() {
double a, b, c, discriminant, root1, root2, realPart, imaginaryPart;
return 0;
}
----------------------------------------------------------------------------------------------------------------
Program 6: WAP using switch statement, asking the user to enter a day(sunday, monday, tuesday,
etc). If the user has entered saturday or sunday then display a message saying “enjoy! Its holiday”,
else display a message saying “so sad, u still have to work”, showing use of break statement also.
Program 7: Write a menu driven program using switch case to do different arithematic operations,
showing use of break statement also
---------------------------------------------------
int main() {
int n, i, isPrime = 1;
return 0;
}
#include <stdio.h>
int main() {
int rows, i, j, space, num;
return 0;
}
Program 4: WAP to display following pattern:
12345
2345
345
45
5
Program 5: WAP to display first 10 prime numbers.
#include <stdio.h>
int main() {
int count = 0, i, j, isPrime;
// check if i is prime
for (j = 2; j <= i / 2; j++) {
if (i % j == 0) {
isPrime = 0;
break;
}
}
return 0;
}
Program 1: WAP to store integer data in an array, and print the elements of the array:
Program 2: WAP to find the sum of all elements of an array.
Program 3: WAP to find the greatest and smallest number in the array.
Program 4: WAP to search a given item in an array.
Program 5: WAP to display the contents of the elements of array that are at odd/even positions.
Program 6: WAP to enter 10 different numbers in an array, then adding the numbers that are
divisible by 3 and displaying the result.
Program 1: WAP to enter 3X3 array. Display the array in the form of a matrix. Then find the product
of the elements of the array that are divisible by 4.
Program 2: WAP to add two matrices.
Program 3: WAP to multiply two matrices.
Program 4: WAP to find the sum of diagonal elements of a square matrix.
Program 5: WAP to find the sum of opposite diagonal elemnts of a square matrix.
Program 6: WAP to find transpose of a matrix.
Topic 9: functions
Program 1: Write a menu driven program to show various arithematic operations using switch and
functions.
Program 2: WAP to find factorial of the number using functions.
Program 3: WAP to show the table of the number using functions.
Program 4: WAP to find whather a number is prime or not using functions.
Program 5: WAP to swap the value of two numbers using functions.
Program 6: WAP to display fibonnaci series using functions.
Program 1: WAP to show the working of call by value and call by reference for sum of two
numbers.
Program 2: WAP to calculate the sum of all the elements of an array using functions.
Program 3: WAP to find the greatest and smallest from the elements of array using functions.
Program 4: WAP to calculate the sum of all elements of an array that are divisible by 5 and are
even.
Program 5: WAP to swap the values of two variables using call by value and call by reference.
(questions of series)
Topic 8: pointers