Hi, I want to know how to "mark" the number as favourite number.
Let say I enter number 2, and the output will show 2 is the favourite number.
I only get to make the loop but not the favourite number part.
#include<stdio.h>
#include<stdlib.h>
#pragma warning (disable:4996)
main(void) {
int i, n;
printf("What is your favourite number (1 to 10)? ");
scanf("%d", &n);
for (i = 1; i <= 10; i+= 1)
{
printf("%d\n", i);
}
system("pause");
}
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int n = 0;
printf("What is your favourite number (1 to 10)? ");
scanf("%d", &n);
for (int i = 1; i <= 10; ++i) {
printf("%d", i);
if (i == n)
printf(" favorite number");
puts("");
}
}