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
18 changes: 0 additions & 18 deletions author- RIYA SINGHAL(4).c

This file was deleted.

6 changes: 3 additions & 3 deletions author-PRAGYA NAINWAL(2).c
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#include<stdio.h>
//Function to calculate the maximum sum of a sub-array of a given array
void maxSumarray(int a, int size){
int maxSumarray(int a[], int size){
int i;
int max_sum_so_far=0;
int max_ending_here = 0;

for(i=0,i<size,i++){
for(i=0;i<size;i++){
max_ending_here =+ a[i];

if(max_ending_here < 0){
max_ending_here =0
max_ending_here =0;
}
if(max_sum_so_far < max_ending_here){

Expand Down
91 changes: 46 additions & 45 deletions author-JASKIRAT SINGH(1).c → correct author-JASKIRAT SINGH(1).c
Original file line number Diff line number Diff line change
@@ -1,45 +1,46 @@
#include<stdio.h>

void transpose(int arr[][],int n)
{
int tra[n][n],i,j;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
tra[i][j]=arr[j][i];
}
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
arr[i][j]=tra[i][j];
}
}

}
int main()
{
int n,i,j;
printf("Enter the order of matrix\n");
scanf("%d",&n);
int arr[n][n];
printf("Enter the elements");
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&arr[i][j]);
}
}
transpose(arr,n);
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
printf("%d\t",arr[i][j]);
}
printf("\n");
}
}
#include<stdio.h>

int n;
void transpose(int arr[][n])
{
int tra[n][n],i,j;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
tra[i][j]=arr[j][i];
}
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
arr[i][j]=tra[i][j];
}
}

}
int main()
{
int i,j;
printf("Enter the order of matrix\n");
scanf("%d",&n);
int arr[n][n];
printf("Enter the elements");
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&arr[i][j]);
}
}
transpose(arr);
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
printf("%d\t",arr[i][j]);
}
printf("\n");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
int main()
{
int x=10;
for(int i=0;i<5;i-=1)
for(int i=0;i<5;i+=1)
{
int x=9;
printf("the value of x variable is %d",x);
printf("the value of x variable is %d\n",x);

}
return 0;
Expand Down
18 changes: 18 additions & 0 deletions corrected author- RIYA SINGHAL(4).c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

#include <stdio.h>

int main()
{
int x=10;
for(int i=0;i<5;i+=1)//INFINITE LOOP
{
int x=9;
printf("the value of x variable is %d\n",x);

}
char y;//ALREADY DECLARED ABOVE
printf("enter any character");
scanf("%c",&y);
printf("the entered character is %c",y);
return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
int main()
{
int x=10;
for(int i=0;i<5;i-=1){
for(int i=0;i<5;i+=1){
int x=9;
printf(x);}
printf("%d",x);}
return 0;
}
34 changes: 17 additions & 17 deletions author-ALI RAZA.c → corrected author-ALI RAZA.c
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# include <stdio.h>
void fun(int &x)
{
*x = 30;
}
int main()
{
int y = 20;
fun(y);
printf("%d", *y);
return 0;
}
# include <stdio.h>
void fun(int *x)
{
*x = 30;
}

int main()
{
int y = 20;
fun(&y);
printf("%d", y);
return 0;
}




16 changes: 8 additions & 8 deletions author-ALWINDER(2).c → corrected author-ALWINDER(2).c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include<stdio.h>
int main(){
char *ptr = "void pointer";
void *vptr;
vptr = &ptr;
printf("%s" , **&(char **)vptr);
return 0;
}
#include<stdio.h>
int main(){
char *ptr = "void pointer";
void *vptr;
vptr = &ptr;
printf("%s" , *(char **)vptr);
return 0;
}
45 changes: 24 additions & 21 deletions author-GURSANGAT(1).c → corrected author-GURSANGAT(1).c
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
# include <stdio.h>
int main()
{
int i = 0;
for (i=0; i<20; i++)
{
switch(i);
{
case 0:
i += 5;
case 1:
i += 2;
case 5:
i += 5;
default:
i += 4;
break;
}
printf("%c "; i);
}
return 0;
# include <stdio.h>
int main()
{
int i = 0;
for (i=0; i<20; i++)
{
switch(i)
{
case 0:
i += 5;
break;
case 1:
i += 2;
break;
case 5:
i += 5;
break;
default:
i += 4;
break;
}
printf("%d ", i);
}
return 0;
}
95 changes: 48 additions & 47 deletions author-HIYA MADAN(1).c → corrected author-HIYA MADAN(1).c
Original file line number Diff line number Diff line change
@@ -1,47 +1,48 @@
/*A string is entered (For example: My name is jessie.)
Here is C program to get its reverse in a column as output i.e.:
jessie
is
name
My
Debug the following program to get the desired output.
*/
#include<stdio.h>
void main()
{
char str[20];
char *ptr=str,*temp;
int i=0,j;
scanf("%[^\n]",str);
while(*ptr)
{
i++;
ptr++;
}
for(j=0;j
{
if(*ptr==' ')
{
temp=ptr;
ptr--;
temp++;
while((*temp!=' ')&&(*temp!='\0'))
{
printf("%c",*temp);
temp++;
}
printf("\n");
}
else
{
ptr--;
}
}
while(*ptr!=' ')
{
printf("%c",*ptr);
ptr++;
}
getch();
}

/*A string is entered (For example: My name is jessie.)
Here is C program to get its reverse in a column as output i.e.:
jessie
is
name
My
Debug the following program to get the desired output.
*/
#include<stdio.h>
#include<conio.h>
void main()
{
char str[20];
char *ptr=str,*temp;
int i=0,j;
scanf("%[^\n]",str);
while(*ptr)
{
i++;
ptr++;
}
for(j=0;j<=i;j++)
{
if(*ptr==' ')
{
temp=ptr;
ptr--;
temp++;
while((*temp!=' ')&&(*temp!='\0'))
{
printf("%c",*temp);
temp++;
}
printf("\n");
}
else
{
ptr--;
}
}
while(*ptr!=' ')
{
printf("%c",*ptr);
ptr++;
}
getch();
}

Loading