This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(){ | |
char name[] = "Hello"; | |
char *ptr; | |
ptr = name; | |
while(*ptr != '\0'){ | |
printf("%c", *ptr); | |
ptr++; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(){ | |
char name[] = "PRATIK"; | |
int i = 0; | |
while(name[i] != '\0'){ | |
printf("%c", name[i]); | |
i++; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(){ | |
char name[20] = "PRATIK"; | |
int i; | |
for(i = 0; i < 7; i++){ | |
printf("%c", name[i]); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main() { | |
int marks[3][3], i, j, sum; | |
for (i = 0; i < 3; i++){ | |
printf("Enter three subject marks of student %d\n", i+1); | |
for (j = 0; j < 3; j++) | |
scanf("%d", &marks[i][j]); | |
} | |
for (i = 0; i < 3; i++) { | |
sum=0; | |
for (j = 0; j < 3; j++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
main() { | |
int array[3][3], i, j; | |
printf("Enter the elements of array:\n"); | |
for (i = 0; i < 3; ++i) { | |
for (j = 0; j < 3; ++j) | |
scanf("%d", &array[i][j]); | |
} | |
for (i = 0; i < 3; ++i) { | |
for (j = 0; j < 3; ++j) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
main () { | |
int a[5], num, flag=0; | |
printf("Enter any five elements of an array:"); | |
for (int i = 0; i < 5; ++i) | |
scanf("%d", &a[i]); | |
printf("Enter the element you want to search:"); | |
scanf("%d", &num); | |
for (int i = 0; i < 5; ++i) | |
if (num == a[i]) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main() { | |
int a[5]; | |
printf("Enter any 5 elements:"); | |
for (int i = 0; i < 5; ++i) | |
scanf("%d", &amp;a[i]); | |
for (int i = 0; i < 5; ++i) | |
printf("%d ", a[i]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main() { | |
int a[5] = {1, 3, 4, 5, 9}; | |
for (int i=0; i < 5; ++i) | |
printf("%d ", a[i]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main() { | |
int row, col; | |
for ( row = 1 ; row <= 5 ; ++row) { | |
for ( col = 1 ; col <= 5 ; ++col) { | |
printf("*"); | |
} | |
printf("\n"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for ( i=1 ; i<=10 ; ++i ) { | |
for ( j=1 ; j<=11 ; ++j ) { | |
block 1; | |
} | |
block 2; | |
} |