Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md → C/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@
| Program-30 | Program to print the pattern |
| Program-31 | Program to take the details of student and print the details of students using array and to add details of new students into the existing array |
| Program-32 | Program to take the details of student and print the details |
| Program-33 | Program on Arithematic operation using pointers |
| Program-34 | Program to determine whether the matrix is a triangular matrix. First, you will be given N, which is the size of the matrix. Then you will be given N rows of integers, where each row consists of N integers separated by spaces. If the input matrix is triangular, then print yes. Otherwise, print no. |
| Program-35 | Program where you are given a sequence of non-negative integers terminated by -1. You have to output 1 if there are atleast 2 distinct elements in the sequence and 0 if the sequence consists of only 1 integer. Note that -1 is not part of the sequence. The sequence is not necessarily sorted. |

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
26 changes: 26 additions & 0 deletions C/program-21/program.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
You are given a sorted (either in the increasing or in the decreasing order) sequence of numbers, ending with a -1. You can assume that are at least two numbers before the ending -1.

Let us call the sequence x0 x1 ... xn -1.

You have to output the number of distinct elements in the sorted sequence.

Kindly do not use arrays in the code.
*/


#include <stdio.h>
#include <stdlib.h>

int main()
{
int count=0,n=0;
while(n!=-1)
{
scanf("%d",&n);
count++;

}
printf("%d",count-1);
return 0;
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions C/program-33/program.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* Arithematic operation using pointers */
#include <stdio.h>
void main()
{
int a,b;
int *x,*y;
scanf("%d%d",&a,&b);
x=&a;
y=&b;
//s=;
printf("%d\t%d",*x+*y,abs(*x-*y));

}

36 changes: 36 additions & 0 deletions C/program-34/program.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* To determine whether the matrix is a triangular matrix.
First, you will be given N, which is the size of the matrix.

Then you will be given N rows of integers, where each row consists of
N integers separated by spaces.
If the input matrix is triangular, then print yes. Otherwise, print
no. */





#include <stdio.h>
#include <stdlib.h>

int main()
{
int a[10][10],n,i,j,flag=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{scanf("%d",&a[i][j]);
}
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(!(i==j) &&(i>j || j>i) ) flag=1;
}
}
if(!(flag))printf("no\n");
else printf("yes");
return 0;
}
25 changes: 25 additions & 0 deletions C/program-35/program.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* You are given a sequence of non-negative integers terminated by -1.
You have to output 1 if there are atleast 2 distinct elements in the sequence and 0 if the sequence consists of only 1 integer.
Note that -1 is not part of the sequence. The sequence is not necessarily sorted. */


#include <stdio.h>
#include <stdlib.h>

int main()
{
int a=0,n=0,count=0;
while(n!=-1)
{
scanf("%d",&n);
if(a!=n)
{
a=n;
count++;
}

}
if(count>=2) printf("%d",1);
else printf("%d",0);
return 0;
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions Python/program-1/program.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("Hello, World!")
1 change: 1 addition & 0 deletions Python/program-2/program.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("Hello, World!")
17 changes: 0 additions & 17 deletions program-21/program.c

This file was deleted.

2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Basic programs
## This repo contains basics programs in c programming language and python.