M

@Mirdula_Sampathkumar

W-4:19.C program to find the sum of all even numbersfrom 1 to N

C
2 years ago
#include <stdio.h> int main() { int N,sum=0; printf("Enter the value of N:\n"); scanf("%d",&N); printf("N=%d\n",N); if(N<=0) { printf("N should be a positive integer.\n");

W-4:18.C program to find sum of All odd numbers between 1 to N

C
2 years ago
#include <stdio.h> int main() { int N,sum=0; printf("Enter the value of N:\n"); scanf("%d",&N); printf("N=%d\n",N); if(N<=0) { printf("N should be a positive integer.\n");

W-4:17.Print number continuously from 1 to 100 except 25,50,75

C
2 years ago
#include <stdio.h> int main() { int i; for(i=1;i<=100;i++) { if(i==25||i==50||i==75) { continue; }

W-4:16.Get integer from user and print it until the user gives a negative number

C
2 years ago
#include <stdio.h> int main() { int n; printf("Enter a number n\n"); scanf("%d",&n); printf("n=%d\n",n); while(n) { if(n<0){

W-4:15.Write a program to print 5*5 box

C
2 years ago
#include <stdio.h> int main() { int i,j,n=5; for(i=1;i<=5;i++) { for(j=1;j<=5;j++) { printf("*"); }

W-4:14.Get input from the user and print it untill the input is 100

C
2 years ago
#include <stdio.h> int main() { int n; scanf("%d",&n); printf("Enter the value of number n=%d\n",n); while(n!=100) { printf("%d\n ",n); scanf("%d",&n);

W-4:13.Get an integer input from user & print how many times it can be divided by 2 till it become1

C
2 years ago
#include <stdio.h> int main() { int n,count=0; scanf("%d",&n); printf("Enter the value of n"); printf("The value of n=%d\n",n); while(n>=2){ n=n/2; count++;

W-4:12.Program to add two integers using do-while loop

C
2 years ago
#include <stdio.h> int main() { int i,j,sum=0; scanf("%d",&i); printf("Enter the first integer:%d\n",i); scanf("%d",&j); printf("Enter the second intger:%d\n",j); do { sum=i+j;

W-4:11.Program to print table for the given number using while loop in C

C
2 years ago
#include <stdio.h> int main() { int i=1,num; scanf("%d",&num); printf("Enter the value of num=%d\n",num); printf("The table of %d:\n",num); while(i<=10) { printf("%d*%d=%d\n",i,num,(i*num));

W-4:10.Program to print 10 multiples of 5 using do-while loop

C
2 years ago
#include <stdio.h> int main() { int i=1; do{ if(i%5==0) printf("%d\n",i); i++; } while (i<=50);

W-4:9.Program to print your name N times using do-while loop

C
2 years ago
#include <stdio.h> int main() { int i=1,N; scanf("%d",&N); printf("Enter the value of N=%d\n",N); do { printf("Mirdula Sampthkumar\n"); i++;

W-4:8.Program to print half pyramid of numbers using nested loops

C
2 years ago
#include <stdio.h> int main() { int i,j,row; scanf("%d",&row); printf("Enter the number of rows:%d\n",row); for(i=1;i<=row;i++) { for(j=1;j<=i;j++) {

W-4:7.Program to print your name n times using for loop

C
2 years ago
#include <stdio.h> int main() { int i,n; scanf("%d",&n); printf("Enter the value of n=%d\n",n); for(i=1;i<=n;i++) { printf("MIRDULA SAMPATHKUMAR\n"); }

W-4:6.Program to print first 10 natural numbers using while loop

C
2 years ago
#include <stdio.h> int main() { int i=1; while(i<=10) { printf("%d ",i); i++; } return 0;

W-4:5.Program to print the Fibonacci series up to a given number using for loop in C language

C
2 years ago
#include <stdio.h> int main() { int n1=0,n2=1,n3,i,n; scanf("%d",&n); printf("Enter the value of n=%d\n",n); printf("n1=0\nn2=1\n"); printf("0\n1\n"); for(i=2;i<=n;i++) {

W-4:4.Program to enter a number and check whether it is a prime number or not using for loop

C
2 years ago
#include <stdio.h> int main() { int n,i,flag=0; scanf("%d",&n); printf("Enter the value of the number n=%d\n",n); for(i=2;i<n;++i) { if(n%i==0) {

W-4:3.Program to check whether a number is Armstrong no or not using C language

C
2 years ago
#include <stdio.h> #include <math.h> int main() { int n,copy,digit=0,sum=0; scanf("%d",&n); printf("Enter the number n=%d\n",n); copy=n; while(copy>0) {

W-4:2.Program to enter a number and check whether that no is the perfect number or not

C
2 years ago
#include <stdio.h> int main() { int n,i=1,sum=0; scanf("%d",&n); printf("Enter the number:%d\n",n); while(i<n) { if(n%i==0); sum=sum+i;

W-4:Program to print the numbers from 1 to 10 using loop

C
2 years ago
#include <stdio.h> int main() { int i; for(i=1;i<=10;i++) printf("%d ",i); return 0; }

Write a C program to display the n terms of ODD natural numbers and their sum

C
2 years ago
#include <stdio.h> int main() { int i,n,sum=0; scanf("%d\n",&n); printf("nth Term=%d\n",n); printf("The odd numbers are=\n"); for(i=1;i<=n;i++) { printf("%d\n",2*i-1);