c program to print digits in words
c program to print digits in words Following c program illustrate how to print digits into words. The code will take an input value of from the user and it prints each digit into correspond word format. For example, if “1234” is given as input, the output should be “one two three four”. #include <stdio.h> […]
pascal triangle c program
Pascal triangle C program C program to print Pascal triangle which you might have studied while studying Binomial Theorem in Mathematics. It takes an input value from the user i.e. number of rows and prints following patterns [quote] Rows you want to input: 5 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 [/quote] #include <stdio.h> int main() { int r,n,i,k,s; printf(“\nRows you […]
prime numbers program in c
prime numbers program in c The following code prints prime numbers using c programming language. the number is prime if it is divisible only by one and itself. Remember two is the only even and the smallest prime number. First, few prime numbers are 2, 3, 5, 7, 11, 13, 17 #include <stdio.h> int main() […]
perfect number program in c
perfect number program in c This program takes an input value from the user and checks a number is a perfect number or not. A perfect number is a positive number which is equal to the sum of all its divisors excluding itself. For example: 28 is a perfect number as 1 + 2 + 4 + 7 + 14 = […]
advance pattern programs in c
Advance pattern programs in c These programs print various patterns of numbers, stars, and spaces. These codes illustrate how to create various patterns using c program. The C programs involve the usage of multiple nesting while loops. Example#1 #include <stdio.h> int main() { int i,n,s,dn; printf(“Enter a value: “); scanf(“%d”,&n); i=1; while(i<=n) // Loop to […]
basic pattern programs in c
Basic pattern programs in c These programs print various patterns of numbers and stars. These codes illustrate how to create various patterns using c program. The C programs involve usage of nesting while loops (a while loop inside a while loop). A pattern of numbers or star or characters is a way of arranging these […]
multiplication table program in c
Multiplication table program in c This program will compute the multiplication table of a given integer value from the user for the given specific number of rows. For example, if the user entered an input value 5 and the number of rows is 10 then it will form a multiplication table of 5 with 10 […]
reverse number program in c language
reverse number program in c language This program reverses a given input number from the user and then print it on the screen. Along with reverse number, we are finding the sum of digits and number of digits also. #include <stdio.h> int main() { int n,rn,sd,nd; printf(“Enter a value: “); scanf(“%d”,&n); rn=sd=nd=0; while(n>0) //+ve //while(n<0)-ve […]
C programming structure union and enum
Structures in c Definition: Structure is a collection of one or more variables of different data types, grouped together under a single name. By using structures we can make a group of variables, arrays, pointers, etc. Features: It is possible to copy the contents of all structure elements of different data types to another structure […]
c programming conditional operators example
c programming conditional operators We already discussed c programming conditional operators with various expressions in our earlier tutorial lets see few examples C program to find the minimum value of 3 variable /* simple example to find min value of 3 variable */ #include <stdio.h> int main() { int x,y,z,min; x=10; y=5; z=20; min = […]