#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
for (int i=1;i<=100;i++)
{
if(i%2 !=0 && i%3 !=0)
{
printf("\n Numbers that are not divisible by 2 or 3:%d \n ",i);
}
printf("\n");
}
getch();
}
include<stdio.h> #include<conio.h> main() { int i; /* looping variable */ for(i=1;i<=100;i++) /* goes from 1 to 100 */ { if((i % 2 == 0) && (i % 3 != 0) && (i % 5 != 0)) /* checks all three conditions */ { printf("%d ",i); /* note the space after 'd' */ } } printf("\nEnd of Program"); /* End */ getch(); }
10 CLS: PRINT "I shall now amaze the audience by printing " 20 PRINT "the four smallest perfect square integers." 30 for N = 1 to 4 : PRINT N, N^2 : NEXT N 40 PRINT: PRINT "Thank you." 50 PRINT "You've been a wonderful audience." 60 PRINT "I'm here until Friday." 70 PRINT "Don't forget to tip your waiter."
For N = 2 to 30 STEP 2 Sum = Sum + N Next N Print "The sum is "; Sum; ". Have a nice day. Come back and see us." END
for (int i = 2; i < 10; i ++) printf("%d\n", i); You did say even and odd numbers between 1 and 10. That's allnumbers between 1 and 10.
There is a computer program that will print out the value of pi to even more decimal places than that.
cls input "enter a no"; num if num mod 14= num then print "no is divisible" else print "not divisible" end if end
You can use int i; for (i = 10; i <= 50; i += 2) {//print i} as a program to print even numbers between 10 and 50.
#include #include#define N 100 /* change the upper limit by changing value of N */int main(){int i;clrscr();printf("\nPROGRAM TO PRINT NUMBERS DIVISIBLE BY 8 between 1 and 100\n");for(i=1;i
Algorithm: multiples input: two positive integers, m and n output: print first n multiples of m i = m; for j = 1 to n print i i = i + m; next j
wap to print all the arnstrong no. between 100&1000
In GW-BASIC, you can print even numbers from 1 to 100 using a simple loop. Here’s a sample code: FOR i = 1 TO 100 IF i MOD 2 = 0 THEN PRINT i NEXT i This program iterates through numbers 1 to 100 and prints each number if it is even (i.e., divisible by 2).
Reference:http:cprogramming-bd.com/c_page2.aspx# strange number
include<stdio.h> #include<conio.h> main() { int i; /* looping variable */ for(i=1;i<=100;i++) /* goes from 1 to 100 */ { if((i % 2 == 0) && (i % 3 != 0) && (i % 5 != 0)) /* checks all three conditions */ { printf("%d ",i); /* note the space after 'd' */ } } printf("\nEnd of Program"); /* End */ getch(); }
10 CLS: PRINT "I shall now amaze the audience by printing " 20 PRINT "the four smallest perfect square integers." 30 for N = 1 to 4 : PRINT N, N^2 : NEXT N 40 PRINT: PRINT "Thank you." 50 PRINT "You've been a wonderful audience." 60 PRINT "I'm here until Friday." 70 PRINT "Don't forget to tip your waiter."
echo 'print a pattern'
Write a c program to print the 100 to 1 nos
To write a program that accepts 5 integers in an array and calculates the average of the first three, you can follow these steps: First, create an array to hold the 5 integers. Then, prompt the user to input the integers and store them in the array. Finally, compute the average of the first three integers by summing them and dividing by 3, and display the result. Here’s a simple example in Python: numbers = [int(input("Enter integer {}: ".format(i + 1))) for i in range(5)] average = sum(numbers[:3]) / 3 print("Average of the first three integers:", average)