-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
modification #15
base: master
Are you sure you want to change the base?
modification #15
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include<stdio.h> | ||
//author: Siddhnta Das | ||
//date of creation: 05/02/20 | ||
int main() | ||
{ | ||
int i; | ||
printf("enter a number \n"); //input an integer number | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need for newline here:
|
||
scanf("%d",&i); | ||
float j; | ||
printf("enter a number \n"); //input a decimal number | ||
scanf("%f",&j); | ||
char ch; | ||
printf("enter the character \n"); //input a character | ||
scanf("%s",&ch); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a potential security risk, as you are reading a string into a single char. You should consider using scanf_s() with %c instead:
EDIT: |
||
printf("%d is an integer \n",i); | ||
printf("%f is a float \n",j); | ||
printf("%s is a character \n",&ch); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Empty line not necessary and return statement missing. |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include<stdio.h> | ||
//author sidhant | ||
//date of creation | ||
int main() | ||
{ | ||
char str1[10],str2[10]; | ||
printf("enter the first name \n"); //input the first name | ||
scanf("%s",&str1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you know the length of the string , you should consider using scanf_s() instead:
EDIT: scanf_s is not part of C99 and is an optional extension of C11. So using it may reduce portability of your code, however most compilers implement it. |
||
printf("enter the last name \n"); //input last name | ||
scanf("%s",&str2); | ||
printf("hello %s %s",&str1,&str2); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing newline in printf. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok sir i really appreciate your efforts to have a look at my report and thanks for the honest reviews |
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Empty line not necessary and return statement missing. |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include<stdio.h> | ||
#define pi 3.14 | ||
//author: Siddhnta Das | ||
//date of creation: 05/02/20 | ||
int main() | ||
{ | ||
int r; | ||
float area; | ||
printf("enter the radius of the circle \n"); | ||
scanf("%d",&r); | ||
area=pi*r*r; | ||
printf("the area of circle is %f",area); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include<stdio.h> | ||
//author: Siddhanta Das | ||
//date of creation: 25/02/20 | ||
int main(void) | ||
{ | ||
int num,deno; | ||
float remainder; | ||
printf("enter the numerator \n"); | ||
scanf("%d",&num); | ||
printf("enter the denominator \n"); | ||
scanf("%d",&deno); | ||
if ((num%deno)==0) | ||
{ | ||
printf("there is no remainder \n"); | ||
} | ||
else | ||
{ | ||
printf("there is remainder \n"); | ||
} | ||
remainder=(num%deno); | ||
printf("remainder is %f",remainder); | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing identation.