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
2 changes: 1 addition & 1 deletion issue1.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ char* reverse(char* str){
char* rev = (char*)malloc(sizeof(str));
int size = strlen(str);
for(int i=0;i<size;i++){
rev[i] = str[i];
rev[i] = str[size-i-1];
}
return rev;
}
Expand Down
2 changes: 1 addition & 1 deletion issue2.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

int main(){
int even = 0;
for(int i = 0; i <= 20; i++){
for(int even = 0; even<= 20; even++){
even *= 2;
printf("%d\t", even);
}
Expand Down
2 changes: 1 addition & 1 deletion issue3.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ int main(){
char new[50] = "";

for(int i = 0; i < 6; i++){
new[i] = z;
new[i] = z[i];
}

for(int i = 0; i < 6; i++){
Expand Down
4 changes: 2 additions & 2 deletions issue4.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

void sort(int a[], int b){
for(int i = 0; i < b; i++){
for(int j = 1; j < b; j++){
for(int j = i+1; j < b; j++){
if(a[i] > a[j]){
int temp = a[i];
a[i] = a[j];
Expand All @@ -20,6 +20,6 @@ int main(){
sort(numbers, 6);

for(int i = 0; i < 6; i++){
printf("%d", numbers[i]);
printf("%d ", numbers[i]);
}
}
6 changes: 5 additions & 1 deletion issue5.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include<stdio.h>
int main(void){
int flag = 0;
int flag ;

printf("Choose the operation:-\n1. Multiples of 2\n2. Multiples of 3\n3. Multiples of 4\n");
scanf(" %d", &flag);
Expand All @@ -12,16 +12,20 @@ int main(void){
for(int i=1;i<6;i++){
printf("%d\t", 2*i);
}
break;

printf("\n");
case 2 :
for(int i=1;i<6;i++){
printf("%d\t", 3*i);
}
break;
printf("\n");
case 3 :
for(int i=1;i<6;i++){
printf("%d\t", 4*i);
}
break;
printf("\n");
default :
printf("Choose a valid option!!!\n");
Expand Down
2 changes: 1 addition & 1 deletion issue6.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ int main(void){
char* str1 = "This is a string";
char* str2 = "This is another string";

if(strcmp(str1, str2))
if(!strcmp(str1, str2))
printf("Strings are same.\n");
else
printf("Strings are not same.\n");
Expand Down
2 changes: 1 addition & 1 deletion issue7.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ int main(void){
int a = 5;
int* b = (int*)malloc(sizeof(int));
*b = 7;
printf("%d\n", (a+b));
printf("%d\n", (a+*b));
}
2 changes: 1 addition & 1 deletion issue8.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include<string.h>
int main(void){
char* str = "Welcome to IEEE\n";
for(int i=0;i<100;i++){
for(int i=0;str[i]!='\0';i++){
printf("%c", str[i]);
}
printf("\n");
Expand Down
2 changes: 1 addition & 1 deletion issue9.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include<stdio.h>
int factorial(int n){
if(n == 2)
if(n == 0)
return 1;
else
return n*factorial(n-1);
Expand Down