Posts

Multidimensional array in c

A multinational company has hired 3 sales persons for marketing/selling its 3 different products in Kathmandu .Each sales person sells each of these products. Write a c program to read number of each product sold by all sales-persons. Calculate total sells of each item and the total sells of each sales-person . Use array C Program source code #include <stdio.h> #include <conio.h> #include <string.h> int main() { int pro[3][3],sum=0; int j ,i ; char per[3][10]={ "first","second","third"}; for (i=0 ; i<3 ; i++) { for(j=0 ; j<3 ; j++) { printf("enter number of selling of %s person %s product:" , per[i] ,per[j] ); scanf("%d", &pro[i][j]); printf("\n"); } } for (i=0 ; i<3 ; i++) { for(j=0 ; j<3 ; j++) { sum = sum + pro[j][i]; } printf("Total sell of %s item is:%d\n",per[i], sum); sum=0; } for (i=0 ; i<3 ; i++)

Print pattern in c - star pattern-5

Image
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 *

C program source code to print reversed string using string function

C program source code to print reversed string using string function Write a C program  to print reversed string using string function C Program source code #include<stdio.h> #include<conio.h> #include<string.h> int main() { char name[100]; printf("Enter any character:"); gets(name); strrev(name); printf("The character after reversing is:"); puts(name); getch(); return 0; } You can Browse related article below for more information and program code related to string function  Does above is helpful , Post you views in comment DO NOT MISS OTHER C PROGRAMMING TUTORIAL * indicates required Email Address *

C program source code to print string length using strlen

C program source code to print string length using strlen Write a C program  to print  string length using strlen C Program source code #include<stdio.h> #include<conio.h> #include<string.h> int main() { char name[100]; printf("Enter the character:"); gets(name); int k; k=strlen(name); printf("The length of the string is:%d",k); getch(); return 0; } You can Browse related article below for more information and program code related to string function  Does above is helpful , Post you views in comment DO NOT MISS OTHER C PROGRAMMING TUTORIAL * indicates required Email Address *

C program source code to print reversed string

C program source code to print reversed string Write a C program  to print reversed string C Program source code #include<stdio.h> #include<string.h> #include<conio.h> int main() { char a[100]; int i,n; printf("Enter any word:\n"); gets(a); n=strlen(a); printf("The reversed array is:\n" ); for(i=n-1; i>=0; i--) printf("%c",a[i]); getch(); 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 *

C program source code to create file in file handling

C program source code to create file in file handling Write a C program  to create file in file handling C Program source code #include<stdio.h> #include<conio.h> int main() { FILE *fptr; fptr=fopen("Test.txt","w"); if(fptr==NULL) { printf("\nFile can not be opened"); } else { printf("File is succesfully created"); } fputs("welcome to c programming",fptr); fclose(fptr); getch(); 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 *

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 *