My Name Is Salman Masood , I am Computer Science &Amp; Maths Graduate from University of Karachi, Pakistan , Teaching Is My Passion and My Aim Is to Deliver All My Knowledge among Those Students Who Can'T Afford Tutors or Expensive Institute Fees. I Will Be Keep Sharing My All Knowledge and Information with You .... Remember Me in Your Prayers !
Tuesday, 26 December 2017
Learn C language Part 20 Search Element in array in c language
#include <stdio.h>
#include <conio.h>
main()
{
int n,i,index=-1;
int x[6]{32,54,23,66,2,1};
printf("Enter the number that u want to search in array: ");
scanf("%d",&n);
for(i=0;i<6;i++)
{
if(x[i]==n)
{
index=i;
break;
}
} //loop end....
if(index==-1)
{
printf("%d doesnot exist in array",n );
}
else
{
printf("%d is found at %d position",n,index);
}
}
Learn C language Part 19 Two Dimenstional Array in C ,Sum and Differnce of Two Matrices
#include<stdio.h>
#include<conio.h>
main()
{
int r,c;
int a[3][3];
int b[3][3];
int d[3][3];
int e[3][3];
//matrices A................................
for(r=0;r<3;r++)
{
for(c=0;c<3;c++)
{
printf("Enter the number at A[%d,%d]: ",r,c);
scanf("%d",&a[r][c]);
}
} //outer loop
//matrices B................................
for(r=0;r<3;r++)
{
for(c=0;c<3;c++)
{
printf("Enter the number at B[%d,%d]: ",r,c);
scanf("%d",&b[r][c]);
}
} //outer loop
//sum of these matrices.............................
for(r=0;r<3;r++)
{
for(c=0;c<3;c++)
{
d[r][c]=a[r][c] +b[r][c];
}
} //outer loop
for(r=0;r<3;r++)
{
for(c=0;c<3;c++)
{
e[r][c]=a[r][c]-b[r][c];
}
} //outer loop
//printing the A.......................
printf("\n\n\nMatrices A: \n");
for(r=0;r<3;r++)
{
printf("|\t");
for(c=0;c<3;c++)
{
printf("%d\t",a[r][c]);
}
printf("|\n");
} //outer loop
//printing the A.......................
printf("\n\n\nMatrices B: \n");
for(r=0;r<3;r++)
{
printf("|\t");
for(c=0;c<3;c++)
{
printf("%d\t",b[r][c]);
}
printf("|\n");
} //outer loop
//printing the sum.......................
printf("\n\n\nMatrices D: (Sum of A & B)\n");
for(r=0;r<3;r++)
{
printf("|\t");
for(c=0;c<3;c++)
{
printf("%d\t",d[r][c]);
}
printf("|\n");
} //outer loop
//printing the sum.......................
printf("\n\n\nMatrices E: (Difference of A & B)\n");
for(r=0;r<3;r++)
{
printf("|\t");
for(c=0;c<3;c++)
{
printf("%d\t",e[r][c]);
}
printf("|\n");
} //outer loop
}
#include<conio.h>
main()
{
int r,c;
int a[3][3];
int b[3][3];
int d[3][3];
int e[3][3];
//matrices A................................
for(r=0;r<3;r++)
{
for(c=0;c<3;c++)
{
printf("Enter the number at A[%d,%d]: ",r,c);
scanf("%d",&a[r][c]);
}
} //outer loop
//matrices B................................
for(r=0;r<3;r++)
{
for(c=0;c<3;c++)
{
printf("Enter the number at B[%d,%d]: ",r,c);
scanf("%d",&b[r][c]);
}
} //outer loop
//sum of these matrices.............................
for(r=0;r<3;r++)
{
for(c=0;c<3;c++)
{
d[r][c]=a[r][c] +b[r][c];
}
} //outer loop
for(r=0;r<3;r++)
{
for(c=0;c<3;c++)
{
e[r][c]=a[r][c]-b[r][c];
}
} //outer loop
//printing the A.......................
printf("\n\n\nMatrices A: \n");
for(r=0;r<3;r++)
{
printf("|\t");
for(c=0;c<3;c++)
{
printf("%d\t",a[r][c]);
}
printf("|\n");
} //outer loop
//printing the A.......................
printf("\n\n\nMatrices B: \n");
for(r=0;r<3;r++)
{
printf("|\t");
for(c=0;c<3;c++)
{
printf("%d\t",b[r][c]);
}
printf("|\n");
} //outer loop
//printing the sum.......................
printf("\n\n\nMatrices D: (Sum of A & B)\n");
for(r=0;r<3;r++)
{
printf("|\t");
for(c=0;c<3;c++)
{
printf("%d\t",d[r][c]);
}
printf("|\n");
} //outer loop
//printing the sum.......................
printf("\n\n\nMatrices E: (Difference of A & B)\n");
for(r=0;r<3;r++)
{
printf("|\t");
for(c=0;c<3;c++)
{
printf("%d\t",e[r][c]);
}
printf("|\n");
} //outer loop
}
Learn C language Part 18 Two Dimenstional Array in C, MATRICES IN C
\
#include <stdio.h>
#include <conio.h>
main()
{
textcolor(RED);
int i,j;
int x[3][3];
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("Enter the number that you want to save on position x[%d,%d] : ",i,j);
scanf("%d",&x[i][j]);
} //inner loop
} //outer loop
printf("\n\n\n");
//printing the matrices .........................................
printf("Matrices A\n");
for(i=0;i<3;i++)
{
printf("|\t");
for(j=0;j<3;j++)
{
printf("%d\t",x[i][j]);
} //inner loop
printf("|");
printf("\n\n");
} //outer loop
}
#include <stdio.h>
#include <conio.h>
main()
{
textcolor(RED);
int i,j;
int x[3][3];
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("Enter the number that you want to save on position x[%d,%d] : ",i,j);
scanf("%d",&x[i][j]);
} //inner loop
} //outer loop
printf("\n\n\n");
//printing the matrices .........................................
printf("Matrices A\n");
for(i=0;i<3;i++)
{
printf("|\t");
for(j=0;j<3;j++)
{
printf("%d\t",x[i][j]);
} //inner loop
printf("|");
printf("\n\n");
} //outer loop
}
Learn C language Part 18 Two Dimenstional Array in C, MATRICES IN C
\
#include <stdio.h>
#include <conio.h>
main()
{
textcolor(RED);
int i,j;
int x[3][3];
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("Enter the number that you want to save on position x[%d,%d] : ",i,j);
scanf("%d",&x[i][j]);
} //inner loop
} //outer loop
printf("\n\n\n");
//printing the matrices .........................................
printf("Matrices A\n");
for(i=0;i<3;i++)
{
printf("|\t");
for(j=0;j<3;j++)
{
printf("%d\t",x[i][j]);
} //inner loop
printf("|");
printf("\n\n");
} //outer loop
}
#include <stdio.h>
#include <conio.h>
main()
{
textcolor(RED);
int i,j;
int x[3][3];
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("Enter the number that you want to save on position x[%d,%d] : ",i,j);
scanf("%d",&x[i][j]);
} //inner loop
} //outer loop
printf("\n\n\n");
//printing the matrices .........................................
printf("Matrices A\n");
for(i=0;i<3;i++)
{
printf("|\t");
for(j=0;j<3;j++)
{
printf("%d\t",x[i][j]);
} //inner loop
printf("|");
printf("\n\n");
} //outer loop
}
Learn C language Part 18 Two Dimenstional Array in C, MATRICES IN C
\
#include <stdio.h>
#include <conio.h>
main()
{
textcolor(RED);
int i,j;
int x[3][3];
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("Enter the number that you want to save on position x[%d,%d] : ",i,j);
scanf("%d",&x[i][j]);
} //inner loop
} //outer loop
printf("\n\n\n");
//printing the matrices .........................................
printf("Matrices A\n");
for(i=0;i<3;i++)
{
printf("|\t");
for(j=0;j<3;j++)
{
printf("%d\t",x[i][j]);
} //inner loop
printf("|");
printf("\n\n");
} //outer loop
}
#include <stdio.h>
#include <conio.h>
main()
{
textcolor(RED);
int i,j;
int x[3][3];
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("Enter the number that you want to save on position x[%d,%d] : ",i,j);
scanf("%d",&x[i][j]);
} //inner loop
} //outer loop
printf("\n\n\n");
//printing the matrices .........................................
printf("Matrices A\n");
for(i=0;i<3;i++)
{
printf("|\t");
for(j=0;j<3;j++)
{
printf("%d\t",x[i][j]);
} //inner loop
printf("|");
printf("\n\n");
} //outer loop
}
Subscribe to:
Posts (Atom)
Pass Dynamically Added Html Table Records List To Controller In Asp.net MVC
Controller Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ...
-
Load event: pictureBox3.Image = Image .FromFile( @"C:\Users\salman\Documents\Visual Studio 2013\Projects\WindowsFormsApplication3\W...