Posts

c program to sort element of one dimensional array in ascending or descending order

c program to sort element of one dimensional array in ascending or descending order Write a program  to sort element of one dimensional array in ascending or descending order Ascending #include<stdio.h> #include<conio.h> int main() { int i,j,n,temp,a[1000]; printf("Enter the number of elements in the array:"); scanf("%d",&n); for(i=0; i<n; i++){ printf("Enter the %d elements of array:",i); scanf("%d",&a[i]); } for(i=0; i<n; i++) { for(j = i+1 ; j<n ; j++) { if(a[i]>a[j]) { temp=a[i]; a[i]=a[j]; a[j]=temp; } } } printf("The sorted list in ascending order is:"); for(i=0; i<n; i++) printf("%d\n",a[i]); getch(); return 0; } Descending #include<stdio.h> #include<conio.h> int main() { int i,j,n,temp,a[1000]; printf("Enter the number of elements in the array:"); scanf("%d",&n); for(i=0; i<n; i++){ printf("Enter the %d elements of array:&qu

c-programming quiz

Following quiz provides Multiple Choice Questions (MCQs) related to C Programming . You will have to read all the given answers and click over the correct answer. You are given 3 to 4 options , you have to click on option  until you are right. 1.Which argument is called actual argument? Argument used in function prototype and function call TRY AGAIN Argument used in only function call perfect Argument used in function description Try again 1.Difference between puts and printf is? puts print in new line but printf print in same line WOW , you are write No difference Try again Printf is user defined function but puts is built-in function Try again

Print pattern in c - number pattern-13

Print pattern in c - number pattern Write a program to print following pattern 12345 4321 123 21 1 Program code int main() { int i,j,k; for(i=5;i>=1;i--) { if(i%2==1) k=1; else k=i; for(j=1;j<=i;j++) { printf("%d",k); if(i%2==1) k++; else k--; } printf("\n"); } return 0; } You can Browse related article below for more information and program code related to recursive function call  Does above is helpful , Post you views in comment DO NOT MISS OTHER C PROGRAMMING TUTORIAL * indicates required Email Address *

Print pattern in c - number pattern-12

Print pattern in c - number pattern Write a program to print following pattern 11111 2222 333 44 5 Program code #include <stdio.h> int main() {     int i, j;     for(i=1;i<=5;i++)     {         for(j=5;j>=i;j--)         {             printf("%d",i);         }         printf("\n");     }     return 0; } You can Browse related article below for more information and program code related to recursive function call  Does above is helpful , Post you views in comment DO NOT MISS OTHER C PROGRAMMING TUTORIAL * indicates required Email Address *

Print pattern in c - number pattern-11

Print pattern in c - number pattern Write a program to print following pattern 55555 4444 333 22 1 Program code #include <stdio.h> int main() {     int i, j;     for(i=5;i>=1;i--)     {         for(j=1;j<=i;j++)         {             printf("%d",i);         }         printf("\n");     }     return 0; } You can Browse related article below for more information and program code related to recursive function call  Does above is helpful , Post you views in comment DO NOT MISS OTHER C PROGRAMMING TUTORIAL * indicates required Email Address *

Print pattern in c - star pattern-4

Print pattern in c - star pattern Write a program to print following pattern * * * * * * * * * * * * * * * * * * * * * * * * * Program code #include <stdio.h> int main () { int rows , i , j , space ; printf ( "Enter number of rows: " ); scanf ( "%d" ,& rows ); for ( i = rows ; i >= 1 ;-- i ) { for ( space = 0 ; space < rows - i ;++ space ) printf ( " " ); for ( j = i ; j <= 2 * i - 1 ;++ j ) printf ( "* " ); for ( j = 0 ; j < i - 1 ;++ j ) printf ( "* " ); printf ( "\n" ); } return 0 ; } You can Browse related article below for more information and program code related to recursive function call  Does above is helpful , Post you views in comment DO NOT MISS OTHER C PROGRAMMING TUTORIAL * indicates required Email Address *

Print pattern in c - star pattern-3

Print pattern in c - star pattern Write a program to print following pattern * * * * * * * * * * * * * * * * * * * * * * * * * Program code #include <stdio.h> int main () { int i , space , rows , k = 0 ; printf ( "Enter the number of rows: " ); scanf ( "%d" ,& rows ); for ( i = 1 ; i <= rows ;++ i ) { for ( space = 1 ; space <= rows - i ;++ space ) { printf ( " " ); } while ( k != 2 * i - 1 ) { printf ( "* " ); ++ k ; } k = 0 ; printf ( "\n" ); } return 0 ; } You can Browse related article below for more information and program code related to recursive function call  Does above is helpful , Post you views in comment DO NOT MISS OTHER C PROGRAMMING TUTORIAL * indicates required Email Address *