C program to print pascal triangle

C program to print pascal triangle #include <stdio.h> long factorial(int); int main() { int i, n, c; printf(“Enter the number of rows you wish to see in pascal triangle\n”); scanf(“%d”,&n); for (i = 0; i < n; i++) { for (c = 0; c <= (n – i – 2); c++) printf(” “); for (c = 0 ; c <= i; c++) printf(“%ld “,factorial(i)/(factorial(c)*factorial(i-c))); printf(“\n”); } return 0; } long factorial(int n) { int c; long result = 1; for (c = 1; c <= n; c++) result = result*c; return result; }

C Program example to Find Quotient and Remainder

c prgram avoid goto

C Program example to Find Quotient and Remainder #include<stdio.h> int main() { printf(“\n\n\t\tEduguru – C prgram example\n\n\n”); int c, d, n, a[100], b[100]; printf(“\n\nEnter number of elements in array :”); scanf(“%d”, &n); printf(“\n\nEnter %d elements\n”, n); for(c = 0; c < n; c++) scanf(“%d”, &a[c]); /* temporarily storing elements into array b starting from end … Read more

C Program to find the Sum of First n Natural numbers using for loop

C Program to find the Sum of First n Natural numbers

C Program to find the Sum of First n Natural numbers using for loop   #include <stdio.h> int main() { int n, count, sum = 0; printf(“Enter the value of n(positive integer): “); scanf(“%d”,&n); for(count=1; count <= n; count++) { sum = sum + count; } printf(“Sum of first %d natural numbers is: %d”,n, sum); … Read more

Matrix multiplication program in C

c program for two-dimensional arrays

Matrix multiplication program in C Matrix multiplication in C language to calculate the product of two matrices (two-dimensional arrays). A user inputs the orders and elements of the matrices. If the multiplication isn’t possible, an error message is displayed. You may have studied the method to multiply matrices in Mathematics. Matrix multiplication in C language … Read more

Sorting program in c

c program to sort array

Sorting program in c /* * C program to accept N numbers and arrange them in an ascending order */ #include <stdio.h> void main() { int i, j, a, n, number[30]; printf(“Enter the value of N \n”); scanf(“%d”, &n); printf(“Enter the numbers \n”); for (i = 0; i < n; ++i) scanf(“%d”, &number[i]); for (i … Read more

Asterisk dialplan function GotoIf : Asterisk command gotoif

asterisk dialplan command gotoif

The GotoIf( ) Application GotoIf( ) uses a special syntax, often called the conditional syntax: GotoIf(expression?destination1:destination2) If the expression evaluates to true, the caller is sent to the first destination. If the expression evaluates to false, the caller is sent to the second destination. So, what is true and what is false? An empty string … Read more

Asterisk DialStatus Channel Varriable

Asterisk channel variable DIALSTATUS Contains a text string signifying result of the last dial attempt: ANSWER: Call is answered. A successful dial. The caller reached the callee. BUSY: Busy signal. The dial command reached its number but the number is busy. NOANSWER: No answer. The dial command reached its number, the number rang for too … Read more

Asterisk cmd MYSQL

This is an ADD-ON of asterisk, is not installed by default and must be downloaded and installed with the asterisk-addons package.  However, in Asterisk 1.8 the addons have been integrated back into Asterisk. MYSQL(): Basic MYSQL Database Functionality (note that the help information returned from ‘show application MYSQL’ is a little misleading – what’s shown … Read more

Asterisk queue callback

SQL Table Structure If using the dialplan below, put the following table into a database called ‘acd‘. CREATE TABLE `bit_callers` ( `uniqueid` varchar(15) NOT NULL default ”, `callback` int(3) NOT NULL default ‘0’, `callbacknum` varchar(15) NOT NULL default ”, PRIMARY KEY (`uniqueid`), KEY `callback` (`callback`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; Dialplan Additions [support-queue] exten => s,1,Answer … Read more

Asterisk – best practice to play multiple sound files in .call files

If you want to play multiple sound file with .call then you can send it like this: Setvar: file_max=2 Setvar: file1=custom/1_message Setvar: file2=custom/2_message After that use asterisk’s dialplan to play files one-by-one. For example like this: exten => 123,3,Set(i=0); exten => 123,n(loop),Set(i=$[ ${i} + 1 ]) exten => 123,n,GotoIF($[ $i > ${file_max} ]?exit) exten => … Read more