Knowee
Questions
Features
Study Tools

write a program to print integer no, from 1 to n where n is the input from the user using do while loop in c language use getch

Question

🧐 Not the exact question you are looking for?Go ask a question

Solution 1

Here is a simple C program that uses a do-while loop to print integers from 1 to n, where n is input from the user. Please note that C does not have a built-in function for getch, so I will use getchar instead.

#include <stdio.h>

int main() {
    int i = 1, n;

    printf("Enter a number: ");
    Knowee AI  is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI  is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI  is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI  is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI  is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI  

This problem has been solved

Similar Questions

create a C program to print Fibonacci series upto a specified number N using while loop.

The output of the code will be ____. int i=5; printf(“%d %d %d”, i, i++, ++i); in c

What is the output of the following piece of code?int i;i = 10;while (i < 20){ printf("%d", i % 2); i++;}

main( ){int i, j ;for ( i = 1 ; i <= 2 ; i++ ){for ( j = 1 ; j <= 2 ; j++ ){if ( i == j )continue ;printf ( “n%d %dn”, i, j ) ;}}}1 22 12 11 23 22 3Error

What will be the output of following program?main( ){int k, num = 30 ;k = ( num > 5 ? ( num <= 10 ? 100 : 200 ) : 500 ) ;printf ( "\n%d", num ) ;}

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.