- This topic has 0 replies, 1 voice, and was last updated 3 years, 4 months ago by .
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.
aiannum.com has rebranded as Progaiz.com
› Forums › CS50’s Introduction to Computer Science by Harvard University on Edx › Week 1: [C] – Data Types, Operators, Conditional Statements, Loops, and Command Line › What is wrong with this if statement
Tagged: conditional statement in c, if statement
[dm_code_snippet background=”yes” background-mobile=”no” slim=”yes” line-numbers=”yes” bg-color=”#abb8c3″ theme=”dark” language=”php” wrapped=”no” height=”” copy-text=”Copy Code” copy-confirmed=”Copied”]
#include<stdio.h>
#include<cs50.h>
int main (void)
{
int t = get_int("enter cents");
int count25 = t/25;
t = t%25;
printf("%i",t);
If (t > 9)
{
int count10 = t/10;
}
else
{
count10 = 0;
}
printf("count10 is%i",count10);
}
[/dm_code_snippet]
Not sure why error showing with
if (t > 9)
t is an integer variable type.
Reply
https://edstem.org/us/courses/176/discussion/1691122[learn_press_profile]
