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
29 changes: 9 additions & 20 deletions Q16_reverse_string.c
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
#include<stdio.h>
#include<conio.h>
void main()
#include <stdio.h>
#include <string.h>
int main()
{
int i, j, k;
char str[100];
char rev[100];
printf("Enter a string:\t");
scanf("%s", str);
printf("The original string is %s\n", str);
for(i = 0; str[i] != '\0'; i++);
{
k = i-1;
}
for(j = 0; j <= i-1; j++)
{
rev[j] = str[k];
k--;
}
printf("The reverse string is %s\n", rev);
getch();
char s[100];
printf("Enter a string\n");
gets(s);
strrev(s);
printf("Reverse string is: %s\n", s);
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <stdio.h>
int main()
{
int a[100],i,n;
printf("enter size of array\n");
scanf("%d ", &n);
printf("enter array\n");
for(i=0;i<n;i++)
scanf("%d ", &a[i]);
if(a[n-1]%10==0)
printf("divisible by 10\n");
else
printf(" not divisible by 10\n");
return 0;
}