xxxxxxxxxx
include<stdio.h>
main()
int a,b,c,d ;
a=0
b=10
c=20
d=100
printf("%d,a")
xxxxxxxxxx
#include <omp.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[])
{
{
printf("Hello World... from thread = %d\n",
omp_get_thread_num());
}
}
xxxxxxxxxx
#include <stdio.h>
int main() {
int num1;
int num2;
int num3;
int sum = 0;
scanf("%d %d %d" , num1 , num2 , num3);
num1= num1 * num1;
num2= num2 * num2;
num3= num3 * num3;
if (num1 > num2 && num1 > num3) {
if (num1 = num2 + num3) {
printf("YES");
sum = 1;
}
}
if (num2 > num1 && num2 > num3) {
if (num2 = num1 + num3) {
printf("YES");
sum = 1;
}
}
if (num3 > num2 && num3 > num1) {
if (num3 = num2 + num1) {
printf("YES");
sum = 1;
}
if (sum ==0) {
printf("NO");
}
return 0;
}
xxxxxxxxxx
#include <stdio.h>
int main()
{
int choice=0;
printf("\n***************************************\n");
printf("1. Open Notepad...\n");
printf("2. Get Ip Address...\n");
printf("3. Shut down the computer...\n");
printf("** Enter your choice :");
scanf("%d",&choice);
switch(choice)
{
case 1:
system("notepad");
break;
case 2:
system("ipconfig");
system("pause");
break;
case 3:
system("SHUTDOWN -S");
system("pause");
break;
default:
printf("\n Invalid choice !!!");
}
return 0;
}
xxxxxxxxxx
#include <stdio.h>
#include <mpi.h>
using namespace std;
int main( int argc, char ** argv)
{
int rank, size;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
char message[255];
char nadawanie[255];
if(rank==0)
{
cin>>nadawanie;
MPI_Send(&nadawanie, 255, MPI_CHAR, 1, 0, MPI_COMM_WORLD);
}
else if(rank == 1)
{
MPI_Recv(&message, 255, MPI_CHAR, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD_ MPI_STATUS_IGNORE);
cout << message << endl;
}
}
xxxxxxxxxx
47961 19/1/2022 1400 634 4 4 346 0 1-2 2-1 13 9 10 7 3 3 2 -1 72 18 24 12
xxxxxxxxxx
#include<stdio.h>
int main()
{
int p,i,j,n,c=0;
float d[20],b[20],a[20][20],e[20][20],output;
printf("\n Enter the DIMENSION of the MATRIX A : ");
scanf("%d",&n);
printf("\n|----- NOTE : Enter the elements of matrix ROW-WISE* -----|\n");
printf("\nEnter elements of MATRIX A :\n");
for(p=0;p<n;p++)
{
for(i=0;i<n;i++)
{
scanf("%f",&a[p][i]);
}
}
printf("\nEnter elements of MATRIX B :\n");
for(p=0;p<n;p++)
{
scanf("%f",&b[p]);
}
for(j=0;j<n-1;j++)
{
if(a[j][j]==0)
{
printf("*This equation is NOT solvable by the Gaussian-elimination method...!* \n");
return 1;
}
for(p=j+1;p<n;p++)
{
e[p][j]=a[p][j]/a[j][j];
c++;
}
for(p=j+1;p<n;p++)
{
for(i=j+1;i<n;i++)
{
a[p][i]=a[p][i]-e[p][j]*a[j][i];
c++;
}
b[p]=b[p]-e[p][j]*b[j];
c++;
a[p][j]=0;
}
}
printf("\nAfter the conversion\n");
printf("\nMatrix A(%dx%d) and Matrix B(%dx1) will be : \n",n,n,n);
for(p=0;p<n;p++)
{
for(i=0;i<n;i++)
{
printf("%.4f ",a[p][i]);
}
printf("%.4f \n",b[p]);
}
printf("\n Output : ");
d[n-1]=b[n-1]/a[n-1][n-1];
c++;
for (p=n-2;p>=0;p--)
{
output = 0.0;
for(i=p+1;i<n;i++)
{
output=output+a[p][i]*d[i];
c++;
}
d[p]=(b[p]-output)/a[p][p];
c++;
}
for(p=0;p<n;p++)
{
printf("%.4f ",d[p]);
}
return 0;
}
xxxxxxxxxx
#include<stdio.h>
int main()
{
int p,i,j,n,c=0;
float d[20],b[20],a[20][20],e[20][20],output;
printf("\n Enter the DIMENSION of the MATRIX A : ");
scanf("%d",&n);
printf("\n|----- NOTE : Enter the elements of matrix ROW-WISE* -----|\n");
printf("\nEnter elements of MATRIX A :\n");
for(p=0;p<n;p++)
{
for(i=0;i<n;i++)
{
scanf("%f",&a[p][i]);
}
}
printf("\nEnter elements of MATRIX B :\n");
for(p=0;p<n;p++)
{
scanf("%f",&b[p]);
}
for(j=0;j<n-1;j++)
{
if(a[j][j]==0)
{
printf("*This equation is NOT solvable by the Gaussian-elimination method...!* \n");
return 1;
}
for(p=j+1;p<n;p++)
{
e[p][j]=a[p][j]/a[j][j];
c++;
}
for(p=j+1;p<n;p++)
{
for(i=j+1;i<n;i++)
{
a[p][i]=a[p][i]-e[p][j]*a[j][i];
c++;
}
b[p]=b[p]-e[p][j]*b[j];
c++;
a[p][j]=0;
}
}
printf("\nAfter the conversion\n");
printf("\nMatrix A(%dx%d) and Matrix B(%dx1) will be : \n",n,n,n);
for(p=0;p<n;p++)
{
for(i=0;i<n;i++)
{
printf("%.4f ",a[p][i]);
}
printf("%.4f \n",b[p]);
}
printf("\n Output : ");
d[n-1]=b[n-1]/a[n-1][n-1];
c++;
for (p=n-2;p>=0;p--)
{
output = 0.0;
for(i=p+1;i<n;i++)
{
output=output+a[p][i]*d[i];
c++;
}
d[p]=(b[p]-output)/a[p][p];
c++;
}
for(p=0;p<n;p++)
{
printf("%.4f ",d[p]);
}
return 0;
}
xxxxxxxxxx
#include<stdio.h>
int main()
{
int p,i,j,n,c=0;
float d[20],b[20],a[20][20],e[20][20],output;
printf("\n Enter the DIMENSION of the MATRIX A : ");
scanf("%d",&n);
printf("\n|----- NOTE : Enter the elements of matrix ROW-WISE* -----|\n");
printf("\nEnter elements of MATRIX A :\n");
for(p=0;p<n;p++)
{
for(i=0;i<n;i++)
{
scanf("%f",&a[p][i]);
}
}
printf("\nEnter elements of MATRIX B :\n");
for(p=0;p<n;p++)
{
scanf("%f",&b[p]);
}
for(j=0;j<n-1;j++)
{
if(a[j][j]==0)
{
printf("*This equation is NOT solvable by the Gaussian-elimination method...!* \n");
return 1;
}
for(p=j+1;p<n;p++)
{
e[p][j]=a[p][j]/a[j][j];
c++;
}
for(p=j+1;p<n;p++)
{
for(i=j+1;i<n;i++)
{
a[p][i]=a[p][i]-e[p][j]*a[j][i];
c++;
}
b[p]=b[p]-e[p][j]*b[j];
c++;
a[p][j]=0;
}
}
printf("\nAfter the conversion\n");
printf("\nMatrix A(%dx%d) and Matrix B(%dx1) will be : \n",n,n,n);
for(p=0;p<n;p++)
{
for(i=0;i<n;i++)
{
printf("%.4f ",a[p][i]);
}
printf("%.4f \n",b[p]);
}
printf("\n Output : ");
d[n-1]=b[n-1]/a[n-1][n-1];
c++;
for (p=n-2;p>=0;p--)
{
output = 0.0;
for(i=p+1;i<n;i++)
{
output=output+a[p][i]*d[i];
c++;
}
d[p]=(b[p]-output)/a[p][p];
c++;
}
for(p=0;p<n;p++)
{
printf("%.4f ",d[p]);
}
return 0;
}