Skip to content
Open
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
Binary file added .DS_Store
Binary file not shown.
19 changes: 19 additions & 0 deletions c_programs/goto.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <stdio.h>
int main()
{
int age;
ineligible:

printf("Enter your age :\n");
scanf("%d", &age);
if (age < 18)
{
printf("You are ineligible ...\n");
goto ineligible;
}
else
{
printf("You are eligible.");
}
return 0;
}
25 changes: 25 additions & 0 deletions c_programs/maxElementArray.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include <stdio.h>

int main() {

int arr[10],max,i,n;

printf("Enter the number of elements of array :\n");
scanf("%d",&n);
printf("Enter the elements :\n");
for(i = 0;i < n;i++) {
scanf("%d",&arr[i]);

}
for(i = 0;i <n;i++) {
if(arr[i] > arr[0] )
arr[0]= arr[i];


}
printf( "maximum is %d",arr[0]);

return 0;


}
17 changes: 17 additions & 0 deletions c_programs/numToBinary.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <stdio.h>
int main()
{
int a[10], n, i;
printf("Enter the number to convert: \n");
scanf("%d",&n);
for (i = 0; n > 0; i++)
{
a[i] = n % 2;
n = n / 2;
}
printf("Binary of the given number= ");
for (i = i - 1; i >= 0; i--)
{
printf("%d",a[i]);
}
}
14 changes: 14 additions & 0 deletions c_programs/staticVar.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <stdio.h>
void func() {
static int i=0; //static variable
int j=0; //local variable
i++;
j++;
printf( "%d and %d\n",i,j);
}
int main()
{
func();
func();
func();
}