Found 1354 Articles for C

C program to convert digit to words

Arnab Chakraborty
Updated on 08-Oct-2021 10:56:42

3K+ Views

Suppose we have a digit d, we shall have to convert it into words. So if d = 5, our output should be "Five". If we provide some d which is beyond the range of 0 and 9, it will return appropriate output.So, if the input is like d = 6, then the output will be "Six".To solve this, we will follow these steps −Define a function solve(), this will take d, if d < 0 and d > 9, then:return ("Beyond range of 0 - 9")otherwise when d is same as 0, then:return ("Zero")otherwise when d is same as ... Read More

C program to find sum and difference using pointers in function

Arnab Chakraborty
Updated on 08-Oct-2021 10:55:02

7K+ Views

Suppose we have two numbers a and b. We shall have to define a function that can calculate (a + b) and (a - b) both. But using a function in C, we can return at most one value. To find more than one output, we can use output parameters into function arguments using pointers. Here in this problem we shall update a with a+b and b with a-b. When we call the function we shall have to pass the address of these two variables.So, if the input is like a = 5, b = 8, then the output will ... Read More

C program to find maximum of four integers by defining function

Arnab Chakraborty
Updated on 14-Sep-2023 02:25:05

37K+ Views

Suppose we have four numbers a, b, c, and d. We shall have to find maximum among them by making our own function. So we shall create one max() function that takes two numbers as input and finds the maximum, then using them we shall find maximum of all four numbers.So, if the input is like a = 5, b = 8, c = 2, d = 3, then the output will be 8To solve this, we will follow these steps −define a function max(), this will take x and yreturn maximum of x and ytake four numbers a, b, ... Read More

C program to find sum and difference of two numbers

Arnab Chakraborty
Updated on 08-Oct-2021 10:50:57

6K+ Views

Suppose we have two integer numbers a, b and two floating point numbers c, d. We shall have to find the sum of a and b as well as c and d. We also have to find the sum of a and c as well. So depending on the printf function style, output may differ.So, if the input is like a = 5, b = 58 c = 6.32, d = 8.64, then the output will be a + b = 63 c + d = 14.960001 a + c = 11.320000To solve this, we will follow these steps −To ... Read More

C Program to read and write character string and sentence

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

25K+ 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 12-Dec-2024 17:16:02

61K+ Views

In C programming language, generally, the special symbols have some special meaning. This language provides low-level access to the memory and it is identified for its performance and efficiency. The C language includes a character set of English alphabets(a-z, A-Z), digits(0-9), and specific meaning with special characters. Some special characters are operators, while combinations like "" are escape sequence. In C symbols are used to perform special operations. Some of the special symbols that are used in C programming are as follows − [] () {}, ; * = # Common Characters in C Programming Let’s understand their definitions, which ... Read More

How to convert binary to Hex by using C language?

Bhanu Priya
Updated on 09-Dec-2024 16:44:29

10K+ Views

Binary numbers are represented in 1’s and 0’s. It can also be referred to as a rational number with a finite representation in the system. This is a quotient of an integer by a power of two. Hexadecimal number system with 16 digits is {0, 1, 2, 3…..9, A(10), B(11), ……F(15)}. In base 16 transfer encoding, each byte of plain text is divided into two 4-bit values, which are represented by two hexadecimal digits. Converting Binary to Hex using C To convert from binary to hexadecimal representation, the bit string is grouped into 4-bit blocks, called nibbles, starting from the ... Read More

What are different types of data in C language?

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

1K+ 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

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