Found 1401 Articles for C

C Program to read and write character string and sentence

Arnab Chakraborty
Updated on 08-Oct-2021 10:48:36

21K+ Views

Suppose you want to take a character, then a string and a sentence (string with spaces) using C. So we shall provide three inputs and print the same as output. The maximum size of the string is 500 here.So, if the input is likecharacter = 'T' string = "ProgrammingLanguage" sentence = "I love programming through C", then the output will beYour character: T Your string: ProgrammingLanguage Your sentence: I love programming through CTo solve this, we will follow these steps −For character we need to use scanf("%c", &character);For string we need to use scanf("%s", string);This step is optional, but required ... Read More

What are the special symbols in C language?

Bhanu Priya
Updated on 02-Sep-2023 15:24:43

50K+ Views

In C programming language, generally, the special symbols have some special meaning and they cannot be used for other purposes.Some of the special symbols that are used in C programming are as follows −[] () {}, ; * = #Let’s understand their definitions, which are as follows −Brackets[] − Opening and closing of brackets are used for array element reference, which indicate single and multidimensional subscripts.Parentheses() − These special symbols are used for function calls and function parameters (Read: Functions in C).Braces{} − Opening and closing of curly braces indicates the start and end of a block of code which ... Read More

What are the different types of keywords in C language?

Bhanu Priya
Updated on 03-Sep-2021 07:18:01

9K+ Views

Keywords are generally called as pre-defined or reserved words in a programming language. Every keyword in C language performs a specific function in a program.Keywords cannot be used as variable names.Keywords have fixed meanings, and that meaning cannot be changed.They are the building block of a 'C' program.C supports 32 keywords.All the keywords are written in lowercase letters.The different types of keywords are as follows −autodoubleintstructbreakelselongswitchcaseenumregistertypedefcharexternreturnunionconstshortfloatunsignedcontinueforsignedvoiddefaultgotosizeofvolatiledoifstaticwhileExampleGiven below is the C program for the Simple Calculator by using the Switch Case − Live Demo#include int main(){    char Operator;    float num1, num2, result = 0;    printf(" Try to Enter ... Read More

How to convert binary to Hex by using C language?

Bhanu Priya
Updated on 19-Jun-2024 23:14:55

7K+ Views

Binary numbers are represented in 1’s and 0’s.Hexadecimal number system with 16 digits is {0, 1, 2, 3…..9, A(10), B(11), ……F(15)}To convert from binary to hex representation, the bit string id is grouped in blocks of 4-bits which are called as nibbles from the least significant side. Each block is replaced by the corresponding hex digit.Let’s see an example to get the clarity on hexadecimal and binary number representation.0011 1110 0101 1011 0001 1101   3    E    5    B   1    DWe write 0X3E5B1D for a hex constant in C language.Another example which What iss how ... Read More

What are different types of data in C language?

Bhanu Priya
Updated on 03-Sep-2021 07:05:41

855 Views

Datatype is the declaration of memory location or variable. Data can be of different types and some of the examples of data types in C language are as follows −Integers, rational numbers, whole numbers, real numbers, complex numbers, vectors, characters etc.Coming to the machine hardware, the data is everything encoded as a string of binary digits 0 and 1 of finite length. In the machines, the integer data is processed in the arithmetic logic unit (ALU) and fractional data is processed in the floating-point unit (FPU). This gets reflected in the built-in or primitive data types of a high-level language.Built-in ... Read More

What are different types of computers according to their size in C?

Bhanu Priya
Updated on 03-Sep-2021 07:03:18

1K+ Views

Computer is an electronic device which can used to store data and to perform operations, based on the size of computer, the computer may be divided into four types they are −Micro-computer (small)Mini-computer (medium)Mainframe computer (large)Supercomputer (very large)Micro-computerThe CPU used in micro-computer is microprocessor, it originated in the late 1970’s. The first micro-computer is around 8-bit microprocessor chips.The chip with 8-bit can retrieve data/instruction from storage, process and manipulate at a time. The cost of micro-computers is economical and are friendly in use. Personal com­puters (PCs) can fall into this category.Mini-computerIt originated in the 1960’s. Initially the mini-computers were 8 ... Read More

C program to insert a node at any position using double linked list

Bhanu Priya
Updated on 03-Sep-2021 06:58:12

2K+ Views

Linked lists use dynamic memory allocation and are collection of nodes.Nodes have two parts which are data and link.Types of Linked ListsThe types of linked lists in C programming language are as follows −Single / Singly linked lists.Double / Doubly linked lists.Circular single linked list.Circular double linked list.Double linked listThe diagram given below depicts the representation of double linked list.ExampleFollowing is the C program to insert a node at any position using double linked list − Live Demo#include #include struct node {    int num;    struct node * preptr;    struct node * nextptr; }*stnode, *ennode; void DlListcreation(int ... Read More

C program to display numbers in reverse order using single linked list

Bhanu Priya
Updated on 03-Sep-2021 06:54:01

603 Views

Linked lists use dynamic memory allocation and are collection of nodes.Nodes have two parts which are data and link.Types of Linked ListsThe types of linked lists in C programming language are as follows −Single / Singly linked listsDouble / Doubly linked listsCircular single linked listCircular double linked listSingle linked listThe diagram given below depicts the representation of single linked list.ExampleFollowing is the C program to display the numbers in reverse order by using the single linked list − Live Demo#include #include struct node {    int num;    struct node *nextptr; }*stnode; void createNodeList(int n); void reverseDispList(); void displayList(); ... Read More

C program to find trailing zero in given factorial

Bhanu Priya
Updated on 03-Sep-2021 06:49:38

4K+ Views

In order to find the trailing zero in a given factorial, let us consider three examples as explained below −Example 1Input − 4Output − 0Explanation − 4! = 24, no trailing zero.Factorial 4! = 4 x 3 x 2x 1 = 24. No trailing zero i.e. at 0’s place 4 number is there.Example 2Input − 6Output − 1Explanation − 6! = 720, one trailing zero.Factorial 6! = 6 x 5 x 4 x 3 x 2 x 1 = 720, one trailing zero, because at 0’s place 0 number is there.Example 3The input is as follows −n = 4 n ... Read More

C program to print Excel column titles based on given column number

Bhanu Priya
Updated on 03-Sep-2021 06:44:31

644 Views

ProblemA program to print Excel column title that corresponds to a given column number (integer value). User has to enter the integer number based on given number it has to print excel column number.SolutionThe solution to print Excel column title that corresponds to a given column number in C programming language is explained below −Example 1Let us see an example.1 -> A 2 -> B ... 26 -> Z 27 -> AA 28 -> AB ...Example 2The input is as follows −number = 3 number = 27 number = 151The output is as follows −Excel column title: C Excel column ... Read More

Previous 1 ... 3 4 5 6 7 ... 141 Next
Advertisements