Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
1
Answer
I need help for using if and else functions in C Programming.
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
sami sam
12y
1.1k
1
Reply
I am sure this program is ok but and dose not WORK.
#include <stdio.h>
int main (){
int x,y,z;
printf("please enter value of x");
scanf("%d",&x);
printf("please enter value of y");
scanf("%d",&y);
if (y == 0) {
printf("You can not divide by zero");}
else{
z = x / y;
printf("divide = %d \n",z);}
and also
#include <stdio.h>
int main (){
int x,y,z;
printf("please enter value of x");
scanf("%d",&x);
printf("please enter value of y");
scanf("%d",&y);
if (y != 0) {
z = x / y;
printf("Divide = %d \n",z);
}
else{
printf("You can not divide by zero");
}
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
file handling
controls