- Write a program to print 1 to 100 numbers using a loop.
- C program to print 1 to 100 numbers using for loop.
- C program to print 1 to 100 numbers using while loop.
This is a very simple program for beginners to understand how loop works.
Program to print 1 to 100 numbers without using loop
C Interview Questions with Answers
Program to Print ASCII value of input character
Program to Add two numbers
C Program to Print 1 to 100 Numbers using For Loop
Let's write a C code to print 1 to 100 numbers using for loop.
#include<stdio.h> int main(){ int i; //Print numbers from 1 to 100 for(i = 1; i <= 100; i++){ printf("%d ",i); } return 0; }
C Program to Print 1 to 100 Numbers using While Loop
In this code example, we are going to use while loop to print numbers from 1 to 100.
#include<stdio.h> int main() { int i=1; //i is less than or equal to 100 while( i <= 100) { //print the value of i printf("%d ", i); //Increment the value of i i++; } return 0; }
Sorting algorithms and their time complexity
Programming questions on Java
No comments:
Post a Comment