V

@vanshu_179

factorial of a number by recursion

C
3 years ago
#include <stdio.h> int fact(int n); int main() { printf("factorial is %d\n",fact(7)); return 0; } int fact(int n){

recurssion

C
3 years ago
#include <stdio.h> void printHW(int count); int main() { printHW(5); return 0; } //recursive function void printHW(int count) {

function to check oif the no. is prime or not

C
3 years ago
#include <stdio.h> #include <math.h> int main() { int n,i; printf("enter a positive integer\n"); scanf("%d",&n); if (n==0 || n==1) { printf("not prime");

print the pattern of '*' using nested loop

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

write a function to calculate area of square, rectangle & circle

C
3 years ago
#include <stdio.h> #include<math.h> float squarearea(float side); float rectanglearea(float a,float b); float circlearea(float rad); int main() { float a=5; float b=10;

function for print a table for n

C
3 years ago
#include <stdio.h> void printtable(int n); int main() { int n; printf("enter the number\n"); scanf("%d",&n);

function for sum of 2 numbers

C
3 years ago
#include <stdio.h> int sum(int a,int b); int main() { int a,b; printf("enter first number\n"); scanf("%d", &a); printf("enter second number\n"); scanf("%d",&b);

function that prints namaste if user is indian & bonjour if user is french

C
3 years ago
#include <stdio.h> void namaste(); void bonjour(); int main() { printf("enter f for french & i for indian : "); char ch; scanf("%c", &ch); if (ch== 'i'){

function

C
3 years ago
#include <stdio.h> void printHello(); void printGoodbye(); void printVANSHIKA(); //function declaration int main() { printHello(); printGoodbye(); printVANSHIKA(); return 0; //function call

print the sum of all the no. b/w 5 and 50 including them

C
3 years ago
#include <stdio.h> int main() { int sum =0; for (int i=5; i<=50;i++) { sum =sum + i; } printf("sum is : %d", sum);

print reverse of the table for a number

C
3 years ago
#include <stdio.h> int main() { int n; printf("enter a no. \n"); scanf("%d",&n); for(int i=10;i>=1;i--){ printf("%d \n",n * i); }

print the factorial of n numbers

C
3 years ago
#include <stdio.h> int main() { int n; printf("enter a no. \n"); scanf("%d",&n); int fact =1; for(int i=1;i<=n; i++) { fact = fact * i;

print all the odd numbers from 5 to 50

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

print 1 to 10 numbers except 6

C
3 years ago
#include <stdio.h> int main() { int n; printf("enter a no \n"); scanf("%d",&n); for(int i=1;i<=10;i++) { if( i != 6 ){

keep taking no as input from user until user enters a no. which is multiple of 7

C
3 years ago
#include <stdio.h> int main() { int i; do{ scanf("%d\n", &i); if ( i % 7 ==0) { break;

armstrong number

C
3 years ago
#include <stdio.h> #include<math.h> int main() { int number,num; double sum = 0; scanf("%d", &num); //num=370 number = num;

keep taking no. as input from user until user enters an odd no.

C
3 years ago
#include <stdio.h> int main() { int n; do{ scanf("%d \n",&n); if (n % 2 != 0) { break; }

program for break

C
3 years ago
#include <stdio.h> int main() { for(int i=1;i <= 50;i++){ if (i==10){ break; } printf("%d \n",i); } printf("end");

print the table of a number input by the user

C
3 years ago
#include <stdio.h> int main() { int n; printf("enter a number \n"); scanf("%d",&n); for(int i=1;i<=10;i++) { printf("%d \n", n*i);

to check the given no. is natural no. or not

C
3 years ago
#include <stdio.h> int main() { int num=1; printf("enter a number \n"); scanf("%d",&num); if (num >= 1){ printf("natural number"); } else{ printf(" not a natural number");