C program to print Numbers in form of Characters

The below program is to print the word representation of a number in C using loop. C program to print Numbers in form of Characters #include <stdio.h> #include<stdlib.h>   void main() { int num,x; int tot = 0;   printf("Enter the number: "); scanf("%d",&num);   while(num>0) { x = num%10; tot = tot*10 + x; … Read more

Categories C

C program to convert a decimal number into a binary number

Decimal System: A number system with base 10 i.e, numbers from 0-9 are used to represent a decimal number system. Binary System: A number system with base 2 i.e, only binary numbers 0 and 1 are used to represent a binary number system. C program to convert a decimal number into a binary number #include … Read more

Categories C

C program to print Matrix Multiplication

The below program is to print multiplication of two matrices. The C printf statement is used to output the result on the screen. C program to print Matrix Multiplication #include <stdio.h> #include<stdlib.h>   void main() {   int a[10][10],b[10][10],c[10][10],r1,c1,r2,c2,i,j,k;   printf("Enter the number of rows in first matrix: "); scanf("%d",&r1);   printf("Enter the number of … Read more

Categories C

C program without using main function

The below program is to write a C program without using main() function and using #define preprocessor directive. C program without using main function #include <stdio.h>   #define programs main   void programs() { printf("C is a programming language."); }#include <stdio.h> #define programs main void programs() { printf("C is a programming language."); } Output C … Read more

Categories C

C program to write Assembly Code in C

The below program is to write an Assembly program in C using asm{} block. The C printf statement is used to output the result on the screen. C program to write Assembly Code in C #include <stdio.h>   void main() { int n = 100, m = 20, out;   asm { mov ax,n mov … Read more

Categories C

C program to print “HELLO” without semicolon

The below program is to print “HELLO” without Semicolon. The C printf statement is used to output the result on the screen. C program to print “HELLO” without semicolon #include <stdio.h>   int main() { if (printf ("HELLO")); return 0; }#include <stdio.h> int main() { if (printf ("HELLO")); return 0; } Output HELLOHELLO

Categories C

C program to swap two numbers

The below program is to swap two numbers with and without using third variable. The C printf statement is used to output the result on the screen. Swapping two numbers simply means interchanging the values of two numeric variables. Before Swapping, A = n1 B = n2 After Swapping, A = n2 B = n1 … Read more

Categories C

C program to reverse a number

The below program can be used to reverse a given number using a loop. The C printf statement is used to output the result on the screen. Reverse Number of abcde = edcba. C program to reverse a number #include <stdio.h>   void main() {   int num, x = 0; int mod;   printf … Read more

Categories C

C program to print sum of digits

The below program gives the sum of all the digits in a variable using loop. The C printf statement is used to output the text and sum value to the screen. Logic: Till the given Number is greater than 0. Remainder = Modulus of Number with 10 Total Sum = Adding Remainder into the Total … Read more

Categories C

C program to check for an Armstrong number

The below program checks for an Armstrong number using a loop. The C printf statement is used to output the result on the screen. A number is called as an Armstrong number if the sum of the cubes of its digits is equal to the number itself. Armstrong Number: abc = (a*a*a) + (b*b*b) + … Read more

Categories C