Convert vowels from upper to lower or lower to upper using C program

Mandalika
Published on 24-Feb-2021 17:48:28
An array of characters is called a string.DeclarationFollowing is the declaration for an array −char stringname [size];For example − char a[50]; string of length 50 charactersInitializationUsing single character constant −char a[10] = { ‘H’, ‘e’, ‘l’, ‘l’, ‘o’ ,‘\0’}Using string constants −char a[10] = “Hello”:;AccessingThere is a control string “%s” ... Read More

Write a C program to find the given number is strong or not

Mandalika
Published on 24-Feb-2021 17:47:24
A strong number is a number, where the sum of the factorial of the digits is equal to the number itself.Example123 != 1!+2!+3!    = 1 + 2 + 6 = 9Here, 123 is not a strong number because, the sum of factorial of digits is not equal to the ... Read More

Write a C program to find two’s complement for a given number

Mandalika
Published on 24-Feb-2021 17:46:04
The two’s complement for a given binary number can be calculated in two methods, which are as follows −Method 1 − Convert the given binary number into one’s complement and then, add 1.Method 2 − The trailing zero’s after the first bit set from the Least Significant Bit (LSB) including ... Read More

What is enumerated data type in C language?

Mandalika
Published on 24-Feb-2021 17:44:21
These are used by the programmers to create their own data types and define what values the variables of these datatypes can hold.The keyword is enum.SyntaxThe syntax for enumerated data type is as follows −enum tagname{    identifier1, identifier2, ……., identifier n };ExampleGiven below is an example for enumerated data ... Read More

Write a C program to delete the duplicate elements in an array

Mandalika
Published on 24-Feb-2021 17:43:27
Try to delete the same numbers present in an array. The resultant array consists of unique elements.The logic to delete the duplicate elements in an array is as follows −for(i = 0;i<number;i++){    for(j = i+1; j < number; j++){       if(a[i] == a[j]){         ... Read More

How to merge to arrays in C language?

Mandalika
Published on 24-Feb-2021 17:41:53
Take two arrays as input and try to merge or concatenate two arrays and store the result in third array.The logic to merge two arrays is given below −J = 0, k = 0 for(i = 0;i<o;i++){ // merging two arrays    if(a[j]<=b[k]){       c[i] = a[j];   ... Read More

Write a C program for sparse matrix

Mandalika
Published on 24-Feb-2021 17:37:33
In a given matrix, when most of the elements are zero then, we call it as sparse matrix. Example − 3 x3 matrix1 1 0 0 0 2 0 0 0In this matrix, most of the elements are zero, so it is sparse matrix.ProblemCheck whether a matrix is a sparse ... Read More

C Program to count trailing and leading zeros in a binary number

Mandalika
Published on 24-Feb-2021 17:36:03
To begin with, let us understand what are trailing zeros in a binary number.Trailing zerosThe position of zeros after first one from the least significant bit (LSB) is called as trailing zeros in binary number.Example104 is decimal numberBinary number of 104 is: (MSB) 1101000(LSB)Here, MSB refers to Most Significant Bit.LSB ... Read More

Write a C program to rotate the bits for a given number

Mandalika
Published on 24-Feb-2021 17:34:43
Consider the factors given below to write a C program to rotate the bits for a given number.Rotating the bit from left to right or right to left.In left rotation, the bits are shifted from left to right.In right rotation, the bits are shifted from right to left.Take a number ... Read More

C Program to check whether the triangle is equilateral, isosceles or scalene

Mandalika
Published on 24-Feb-2021 17:33:28
Triangle consists of three sides and three angles. Based on the three sides, there are three types of triangle −Equilateral triangle: All three sides are equal.Isosceles triangle: All two sides are equal.Scalene triangle: No sides are equal.Follow the algorithm given below for writing the respective program.AlgorithmStep 1: Declare three sides ... Read More
1 2 3 4 5 6 7 ... 4559 Next
Advertisements