Learn C ProgrammingLearn ProgrammingPrograms On ArraysResources 067. Write a program to accept a number n from user and then accept n array elements from user and reprint them in reverse order of inputs in C language #include<stdio.h> #include<conio.h> main() { int n,i,a[20]; clrscr(); printf("Enter number..."); scanf("%d",&n); printf("Enter array elements :\n" );…Prashant ChaudhariSeptember 18, 2012
Learn C ProgrammingLearn ProgrammingPrograms On ArraysResources 066. Write a program to accept a number n from user and then accept n array elements from user and reprint them in C language #include<stdio.h> #include<conio.h> main() { int n,i,a[20]; clrscr(); printf("Enter number..."); scanf("%d",&n); printf("Enter array elements :\n" ); for(i=0;i<n;i++) { printf("Enter element %d : ",i+1); scanf("%d",&a[i]); } for(i=0;i<n;i++)…Prashant ChaudhariSeptember 18, 2012
Learn C ProgrammingLearn ProgrammingPrograms On More On FunctionsResources 065. Write a program to print factorial of a given number using recursive function in C language #include<stdio.h> #include<conio.h> #include<process.h> int fact(int n) { int f; if(n==1) return 1; else f=n*fact(n-1); return…Prashant ChaudhariSeptember 18, 2012
Learn C ProgrammingLearn ProgrammingPrograms On More On FunctionsResources 064. Write a program using recursions for fibbonacci series in C language #include<stdio.h> #include<conio.h> #include<process.h> fibbo(int pre, int cur ,int x) { int temp; if(x==2) { getch();…Prashant ChaudhariSeptember 18, 2012
Learn C ProgrammingLearn ProgrammingPrograms On More On FunctionsResources 063. Write a program to accept two numbers from user and swap their values using call by reference method in C language #include<stdio.h> #include<conio.h> #include<process.h> swap(int *x ,int *y) { int temp; temp=*x; *x=*y; *y=temp; } main()…Prashant ChaudhariSeptember 18, 2012
Learn C ProgrammingLearn ProgrammingPrograms On FunctionsResources 062. Write a program to calculate square and cube of a given number in C language #include<stdio.h> #include<conio.h> int square(int x) { return(x*x); } int qube(int x) { return(x*x*x); } main()…Prashant ChaudhariSeptember 18, 2012
Learn C ProgrammingLearn ProgrammingPrograms On FunctionsResources 061. Write a program to accept a number from user and print it’s factorial, check if it prime or not , and print it’s fibbonacci series using different functions in C language #include<stdio.h> #include<conio.h> fact(int x) { int i,fact=1; for(i=1;i<=x;i++) fact=fact*i; printf("Factorial is : %d",fact); } IsPrime(int x) { int i; for(i=2;i<x-1;i++)…Prashant ChaudhariSeptember 18, 2012
Learn C ProgrammingLearn ProgrammingPrograms On FunctionsResources 060. Write a program to accept two numbers from user and print it’s addition,subtraction,multiplication,division using different functions in C language #include<stdio.h> #include<conio.h> int add(int x,int y) { return(x+y); } int sub(int x,int y) { return(x-y);…Prashant ChaudhariSeptember 18, 2012
Learn C ProgrammingLearn ProgrammingPrograms On Case Control StructureResources 059. Write a Program to accept two numbers and a operator (+, -, *, / from user and complete that particular operation only in C language #include<stdio.h> #include<conio.h> main() { int n,rem,a,b; char op; clrscr(); printf("Enter Operator(+,-,*,/)..."); scanf("%c",&op); printf("Enter numbers..."); scanf("%d%d",&a,&b);…Prashant ChaudhariSeptember 18, 2012
Learn C ProgrammingLearn ProgrammingPrograms On Case Control StructureResources 058. Write a program to accept a number from user and print that number in words but in reverse order in C language E.g. 153 -> THREE FIVE ONE #include<stdio.h> #include<conio.h> main() { int n,rem; clrscr(); printf("Enter number...");…Prashant ChaudhariSeptember 18, 2012