Bhanu Priya has Published 1449 Articles

What is a simple assertion in C language?

Bhanu Priya

Bhanu Priya

Updated on 26-Mar-2021 07:47:41

285 Views

An assertion is a statement which is used to declare positively that a fact must be true when that line of code is reached.Assertions are useful for obtaining the expected conditions which are met.Simple AssertionSimple assertion can be implemented by using assert (expression) method, which is present in assert.h header ... Read More

C Program to find sum of perfect square elements in an array using pointers.

Bhanu Priya

Bhanu Priya

Updated on 26-Mar-2021 07:45:42

2K+ Views

ProblemWrite a program to find the sum of perfect square elements in an array by using pointers.Given a number of elements in array as input and the sum of all the perfect square of those elements present in the array is output.SolutionFor example, Input= 1, 2, 3, 4, 5, 9, ... Read More

C program to swap two strings

Bhanu Priya

Bhanu Priya

Updated on 26-Mar-2021 07:45:27

11K+ Views

For swapping two strings from one location to another location, we use strcpy() function.An array of characters (or) collection of characters is called a string.DeclarationFollowing is the declaration for an array −char stringname [size];For example, char string[50]; string of length 50 characters.InitializationUsing single character constantchar string[10] = { ‘H’, ‘e’, ... Read More

C program to represent the alphabets in spiral pattern

Bhanu Priya

Bhanu Priya

Updated on 26-Mar-2021 07:44:06

281 Views

The spiral pattern to represent the alphabets is as follows −The logic used to represent the alphabets in spiral model is as follows −if(rows=1){    for(i=1;i

C program to add all perfect square elements in an array.

Bhanu Priya

Bhanu Priya

Updated on 26-Mar-2021 07:42:51

2K+ Views

ProblemWrite a program to find the sum of perfect square elements in an array.Given a number of elements in array as input and the sum of all the perfect square of those elements present in the array is output.SolutionFor example, Input= 1, 2, 3, 4, 5, 9, 10, 11, 16 ... Read More

C program to represent the numbers in spiral pattern

Bhanu Priya

Bhanu Priya

Updated on 26-Mar-2021 07:41:25

1K+ Views

The spiral pattern to represent the numbers is shown below −The logic applied to print the numbers in spiral pattern is as follows −for(i=1;i

C program to find array type entered by user using pointers.

Bhanu Priya

Bhanu Priya

Updated on 26-Mar-2021 07:39:56

585 Views

ProblemWrite a C Program to find the array type that we need to check, whether the given elements in an array are even numbers or odd numbers or combination of both by using pointers.SolutionThe user has to enter an array of integers, then, display the type of the array.Example 1 ... Read More

C Program to display the numbers in X pattern

Bhanu Priya

Bhanu Priya

Updated on 26-Mar-2021 07:37:30

2K+ Views

Refer an algorithm given below for the C program to display the numbers in X pattern.AlgorithmStep 1: Start Step 2: Declare variables Step 3: Read number of rows Step 4: for loop satisfiesif(i==j || i+j==rows-1)print i+1Print " "Step 5: Print new line Step 6: StopThe logic to print numbers in ... Read More

C program to find type of array entered by the user.

Bhanu Priya

Bhanu Priya

Updated on 26-Mar-2021 07:34:34

940 Views

ProblemWrite a C Program to find the array type which we need to check, whether the given elements in an array are even numbers or odd numbers or combination of both.SolutionSo, user has to enter an array of integers, then, display the type of the array.Example 1 − Input: 5 ... Read More

C program for testing the character type

Bhanu Priya

Bhanu Priya

Updated on 26-Mar-2021 07:33:20

1K+ Views

There are some predefined functions available in "ctype.h" library for analyzing the character input and converting them.Analysis FunctionsThe character analysis functions are listed below −FunctionChecks whether entered character isisalphaAn alphabet (or) notisdigitA digit (or) notisspace QA space, a newline (or) tabispunct (A special symbol (or) notislowerA lower case letter of ... Read More

Advertisements