Basic programs in C (beginners)
1.basic input output of strings in c
#include<stdio.h>
#include<string.h>
int main()
{
char name[50],b[59];
int a;
printf("\n:enter your bio data:\n");
printf("enter your name :\n");
gets(name);
printf("enter your father's name: ");
gets(b);
printf("\nenter your date of birth");
scanf("%d",&a);
printf("\nyour cv is as follows-");
printf("\nName:%s",name);
printf("\nFather's name:%s",b);
printf("\nyour DOB : %d",a);
return 0;
}
2.right triangle by symbol
#include<stdio.h>
int main()
{
int i,j,rows;
printf("enter no of rows");
scanf("%d",&rows);
for(int i=1; i<=rows; i++) {
for(int j=1; j<=i; j++) {
printf("*");
}
printf("\n");
}
return 0;
}
3.A(lowercase uppercase)
#include<stdio.h>
int main()
{
char ch;
printf("enter the character"); scanf("%c",&ch);
if(ch <= 122 && ch >= 97){
printf("it is in lowercase");
}
if(ch <= 90 && ch >=65){
printf("it is in uppercase");
}
return 0;
}
B.(if _else logic building)
#include<stdio.h>
int main()
{
float tax=0,income;
printf("enter your annual income");
scanf("%f",&income);
if(income>=250000 && income<=500000){
tax = tax + 0.05*(income - 250000);
}
if(income>=500000 && income<=1000000){
tax = tax + 0.20*(income - 250000);
}
if(income>=1000000){
tax = tax + 0.30*(income - 250000);
}
printf("your net income tax to be paid is %f \n",tax);
return 0;
}
4.greatest among 4 nos.
#include<stdio.h>
int main()
{
int num1,num2,num3,num4;
printf("enter first number");
scanf("%d",&num1);
printf("enter second number");
scanf("%d",&num2);
printf("enter third number");
scanf("%d",&num3);
printf("enter fourth number");
scanf("%d",&num4);
if(num1>num2) {
if(num1>num3) {
if(num1>num4) {
printf("%d is greatest",num1);
} else {
printf("%d is greatest",num4);
}
}
}
else if(num2 > num3) {
if(num2 > num4) {
printf("%d is greatest",num2);
}
else {
printf("%d is greatest",num4);
}
}
else if(num3> num4) {
printf("%d is greatest",num3);
}
else {
printf("%d is greatest",num4);
}
return 0;
}
5.list of whole no.
#include<stdio.h>
int main()
{
int i=0,n;
printf("list of whole numbers\n");
printf("enter the value of n:\n");
scanf("%d",&n);
do {
printf("the number is %d \n",i);
i++;
} while(i<=n);
return 0;
}
6.switch case basic
#include<stdio.h>
int main()
{
printf("Hello world!");
int score;
printf("\nEnter score( 0-100 ): ");
scanf("%d", &score);
switch( score / 10 )
{
case 10:
case 9:
printf("Grade: A");
break;
case 8:
printf("Grade: B");
break;
case 7:
printf("Grade: C");
break;
case 6:
printf("Grade: D");
break;
case 5:
printf("Grade: E");
break;
default:
printf("Grade: F");
break;
}
return 0;
}
7.check for prime
#include<stdio.h>
int main()
{
//chk for prime numbers
int n, prime = 1;
printf(" enter n \n");
scanf("%d",&n);
for(int i = 2; i < n ; i++) {
if(n%i==0) {
prime = 0;
break;
}
}
if(prime == 0) {
printf("this is not a prime number");
}
else {
printf("this is a prime number");
}
return 0;
}
8.game no.1
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main()
{
int number,guess,nguesses=1;
srand(time(0));
number = rand()% 100 +1;
// printf("the number is %d "number);
//keep running the loop until the number is guessed
do {
printf("guess the number between 1 to 100\n");
scanf("%d",&guess);
if(guess > number) {
printf("lower number plz! \n");
}
else if(guess < number) {
printf("higher number plz!\n");
}
else{
printf("you guessed the number in %d attempts\n",nguesses);
}
nguesses ++;
} while(guess != number);
return 0;
}
9.recursion(factorial)
#include<stdio.h>
int factorial(int x);
int main()
{
int a;
printf("enter value of a \n");
scanf("%d",&a);
printf("the value of factorial %d is %d\n",a,factorial(a));
return 0;
}
int factorial(int x) {
if(x == 0 || x == 1 ) {
return 1;
}
else {
return x * factorial(x - 1);
}
}
10. celcius to Fahrenheit
#include<stdio.h>
int main()
{
float celsius, Fahrenheit = 0;
printf("program to convert celsius to Fahrenheit\n");
printf("enter the value in celsius");
scanf("%f",celsius);
Fahrenheit = (celsius * 9/5) + 32 ;
printf("the temperature is %f deg Fahrenheit", Fahrenheit);
return 0;
}
11.calculate F= ma
#include<stdio.h>
float force(float mass);
int main()
{
float m;
printf("enter mass in kgs\n");
scanf("%f",&m);
printf("Force is %.2f N \n",force(m));
return 0;
}
float force(float mass){
float result = (mass * 9.8);
}
12. Fibonacci sequence
#include<stdio.h>
int fib(int n);
int main()
{
int n,i=0,c;
printf("enter no.of terms u wnt to print on Fibonacci series \n :");
scanf("%d",&n);
for(c=1;c <= n;c++){
printf("%d,",fib(i),i++);
}
return 0;
}
int fib(int n) {
if(n == 0) {
return 0;
}
else if(n == 1) {
return 1;
}
else {
return fib(n -1) + fib(n - 2);
}
}
13.multiplication table.
#include<stdio.h>
int main()
{
int i,n,c,product;
printf("multiplication table of n\n");
printf("enter n:-\n");
scanf("%d",&n);
printf("upto which no. u want the table:-\n");
scanf("%d",&c);
printf("multiplication table of %d is as follows \n",n);
for(i=1; i <= c; i++) {
product = (n * i);
printf("%d*%d= %d\n ",n,i,product);
}
return 0;
}
14.
#include<stdio.h>
int main()
{ int i,sum,sqsum;
printf("enter nth term:-\t");
scanf("%d",&i);
sum = (i * (i +1))/2;
sqsum= (i*(i +1)*((2*i)+1))/6;
printf("the sum upto n natural numbers is:- %d",sum);
printf("the sum upto n natural numbers squared is:- %d",sqsum);
return 0;
}
15.printing the ascii value.
#include<stdio.h>
int main()
{
char ch;
printf("enter any character:\n");
scanf("%c",&ch);
printf("the ascii value of %c is %d",ch,ch);
return 0;
}
16.
#include<stdio.h>
int main()
{
float BS,DA,HR,TA,GS;
printf("enter your Basic salary:\nRs.");
scanf("%f",&BS);
DA=(12 * 0.01)*BS;
HR=(7 * 0.01)*BS;
TA=(5 * 0.01)*BS;
GS=(BS + DA + HR + TA);
printf("Your Gross salary is Rs.%.2f\n",GS);
return 0;
}
17.swapping numbers
#include<stdio.h>
void main()
{
int a,b;
printf("enter 2 nos.:\n");
scanf("%d %d",&a,&b);
printf("before swap,a=%d,b=%d \n",a,b);
a = a + b;
b = a - b;
a = a - b;
printf("after swap,a=%d,b=%d",a,b);
}
18.result calculation
#include<stdio.h>
void main()
{
float phy,chem,bio,math,comp;
float percentage;
printf("enter your marks in physics:\n");
scanf("%f",&phy);
printf("enter your marks in chemistry:\n");
scanf("%f",&chem);
printf("enter your marks in maths:\n");
scanf("%f",&math);
printf("enter your marks in biology:\n");
scanf("%f",&bio);
printf("enter your marks in computer:\n");
scanf("%f",&comp);
percentage= (phy + chem +math + bio + comp)/5 ;
printf("your percentage is %f\n", percentage);
if(percentage >= 90) {
printf("your grade:A\n");
}
if(percentage >= 80 && percentage <=90) {
printf("your grade:B\n");
}
if(percentage >= 70 && percentage <=80) {
printf("your grade:C\n");
}
if(percentage >= 60 && percentage <=70) {
printf("your grade:D\n");
}
if(percentage >= 40 && percentage <=60) {
printf("your grade:E\n");
}
if(percentage < 40) {
printf("your grade:F\n");
}
}
19.income tax calculation from any data
#include<stdio.h>
void main()
{
float BS,DA,HR,GS;
printf("enter your Basic salary:\nRs.");
scanf("%f",&BS);
if(BS <= 10000) {
DA=(80 * 0.01)*BS;
HR=(20* 0.01)*BS;
}
if(BS <= 20000 && BS >= 10000) {
DA=(90 * 0.01)*BS;
HR=(25* 0.01)*BS;
}
if(BS > 20000) {
DA=(95 * 0.01)*BS;
HR=(30* 0.01)*BS;
}
GS=(BS + DA + HR );
printf("Your Gross salary is Rs.%.2f\n",GS);
}
20.greatest among three nos.
#include <stdio.h>
int main()
{ int a,b,c;
printf("enter three numbers:\n");
scanf("%d %d %d",&a,&b,&c);
if(a > b) {
if(a > c) {
printf("%d is the greatest number",a);
}
else {
printf("%d is the greatest number",c);
}
}
else if(b > a) {
if(b > c) {
printf("%d is the greatest number",b);
}
else {
printf("%d is the greatest number",c);
}
}
else {
printf("%d is the greatest number",c);
}
return 0;
}
21.calculate profit or loss(sp cp)
#include<stdio.h>
int main()
{
float cp,sp,profit,loss;
printf("enter the cost price:\nRs.");
scanf("%f",&cp);
printf("enter the selling price:\nRs.");
scanf("%f",&sp);
if(cp > sp){
loss = cp - sp;
printf("you made a loss of Rs.%.2f\n",loss);
}
else if(sp > cp){
profit = sp - cp;
printf("you made a profit of Rs.%.2f\n", profit);
}
else {
printf("you're having no gain no loss");
}
return 0;
}
22.greater of the 2 nos.
#include<stdio.h>
int main()
{int num1, num2;
printf("enter two distinct numbers:\n");
scanf("%d %d",&num1,&num2);
if(num1>num2){
printf("%d is greater",num1);
}
else{
printf("%d is greater",num2);
}
return 0;
}
23.leap year in c
#include <stdio.h>
int main() {
int year;
printf("Enter a year: ");
scanf("%d", &year);
// leap year if perfectly divisible by 400
if (year % 400 == 0) {
printf("%d is a leap year.", year);
}
// not a leap year if divisible by 100
// but not divisible by 400
else if (year % 100 == 0) {
printf("%d is not a leap year.", year);
}
// leap year if not divisible by 100
// but divisible by 4
else if (year % 4 == 0 && year % 100 != 0) {
printf("%d is a leap year.", year);
}
// all other years are not leap years
else {
printf("%d is not a leap year.", year);
}
return 0;
}
24.printng upto n natural no.
#include<stdio.h>
int main()
{ int i,n;
printf("enter a number upto which u want ");
scanf("%d",&n);
for(i=1;i<=n;i++){
printf("%d\n",i);
}
return 0;
}
25.even sum odd sum and total sum
#include<stdio.h>
int main()
{
int i, number, Even_Sum = 0, Odd_Sum = 0,tot_sum = 0;
printf("\n Please Enter the Maximum Limit Value : ");
scanf("%d", &number);
for(i = 1; i <= number; i++)
{
if ( i%2 == 0 )
{
Even_Sum = Even_Sum + i;
}
else
{
Odd_Sum = Odd_Sum + i;
}
}tot_sum = Even_Sum + Odd_Sum ;
printf("\n The Sum of Even Numbers upto %d = %d", number, Even_Sum);
printf("\n The Sum of Odd Numbers upto %d = %d", number, Odd_Sum);
printf("\n the total sum upto %d is %d",number,tot_sum);
return 0;
}
26.list of odd & even nos.
#include<stdio.h>
void main()
{
int n,last;
printf("\n Enter Last Number : ");
scanf("%d",&last);
//While Loop
//Code For Even Number List
printf("\n Even Number List :\n ");
n=2;
while(n<=last)
{
printf(" %d",n);
n=n+2;
}
//Code For Odd Number List
printf("\n\n Odd Number List :\n ");
n=1;
while(n<=last)
{
printf(" %d",n);
n=n+2;
}
}
27.Floyd triangle
#include<stdio.h>
int main()
{
int i,j,rows,number=1;
printf("enter no of rows");
scanf("%d",&rows);
for(int i=1; i<=rows; i++) {
for(int j=1; j<=i; j++) {
printf("%d ",number);
++number;
}
printf("\n");
}
return 0;
}
28.Equilateral triangle by ***
#include <stdio.h>
int main() {
int n,i,j;
// number of rows.
printf("enter no.of rows:");
scanf("%d",&n);
for(i = 1; i <= n; i++) {
for(j = 1; j <= n-i; j++)
printf(" ");
for(j = 1; j <= i; j++)
printf("* ");
printf("\n");
}
return 1;
}
29.Sum of prime number(for loop)w
#include<stdio.h>
int main()
{
int l,u,x,i,sum=0;
printf("enter two numbers:");
scanf("%d %d",&l,&u);
for(x=l; x<=u; x++) {
for(i=2; i<x; i++) {
if(x % i == 0)
break;
}
if(i ==x) {
printf("%d ",x);
sum += x;
}
}
printf("\nsum is: %d",sum);
return 0;
}
30.Sum of prime number (while loop)
#include<stdio.h>
int main()
{
int l,u,x,i, sum=0;
printf("enter two numbers:");
scanf("%d %d",&l,&u);
x=l;
while(x<=u) {
i=2;
while(i<x){
if( x % i == 0)
break;
i++;
}
if(i == x){
printf("%d ",x);
sum += x;
}
x++;
}
printf("\nthe sum is: %d",sum);
return 0;
}
31.Fibonacci sequence (while loop)
#include<stdio.h>
int main()
{
int a=0,b=1,next,n;
printf("enter a number:");
scanf("%d",&n);
printf("Fibonacci sequence is:\n%d_%d_",a,b);
int i=0;
while(i<n-3){
printf("%d_",next);
a=b;
b=next;
next=a+b;
++i;
}
return 0;
}
32.Check for prime(while loop)
#include<stdio.h>
int main()
{ int n,prime,i;
printf("enter a number:");
scanf("%d",&n);
i=2;
while(i<= n/2) {
if(n%i==0)
prime=1;
++i;
}
if(prime == 0)
printf("The no. %d is prime",n);
else
printf("the no. %d is composite",n);
return 0;
}
33.Multiplication table (while loop)
#include<stdio.h>
int main()
{
int i,n,c,product;
printf("multiplication table of n\n");
printf("enter n:-\n");
scanf("%d",&n);
printf("upto which no. u want the table:-\n");
scanf("%d",&c);
printf("multiplication table of %d is as follows \n",n);
i=1;
while(i <= c) {
product = (n * i);
printf("\n%d*%d= %d ",n,i,product);
++i;
}
return 0;
}
34.Pyramid (for loop)
Row: total no of rows
Space: total space in a row
K: is for no of symbols in is row
#include <stdio.h>
int main() {
int i, space, rows, k;
printf("Enter the number of rows: ");
scanf("%d", &rows);
for (i = 1; i <= rows; i++) {
for (space = 1; space <= (rows - i); space++) {
printf(" ");
}
for(k=1; k <= ((2*i)-1); k++) {
printf("$");
}
printf("\n");
}
return 0;
}
35.No.of valid digits in a number.
#include<stdio.h>
int main()
{ int n,m,i;
printf("enter a number");
scanf("%d",&n);
for(m=n; n!=0; i++) {
n= n/10;
}
printf("no of valid digits are %d",i);
return 0;
}
36.Reversing a number
#include <stdio.h>
int main() {
int n, rev = 0, remainder;
printf("Enter an integer: ");
scanf("%d", &n);
while (n != 0) {
remainder = n % 10;
rev = rev * 10 + remainder;
n /= 10;
}
printf("Reversed number = %d", rev);
return 0;
}
37.Power of a number
#include<stdio.h>
int main()
{int i,base,exp,m,pow;
printf("enter any nomber as base:\n");
scanf("%d",&base);
printf("\nenter the exponent\n");
scanf("%d",&exp);
//m=pow(base,exp);
//printf("the reqd.no.is %d",m);
pow=1;
i=1;
while(i<=exp){
pow=pow*base;
i++;
}
printf("\nthe reqd number is %d",pow);
return 0;
}
38.Reverse of a no.and chk for palindrome
#include<stdio.h>
int main()
{ int i,n,m,rem=0,rev=0;
printf("enter any nomber:");
scanf("%d",&n);
m=n;
while(n !=0) {
rem=n%10;
rev=(rev*10)+rem;
n=n/10;
i++;
}
printf("the reverse of %d is %d",m,rev);
if(m == rev) {
printf("\nthe no.%d is a palindrome",m);
}
else
{
printf("\nthe no.%d is not a palindrome",m);
}
return 0;
}
39.Chk for armstrong no.
include <stdio.h>
int main() {
int n,m, rem, i= 0,arm = 0;
printf("Enter an integer: ");
scanf("%d", &n);
m = n;
// store the number of digits of num in i
while (m != 0) {
m/= 10;
++i;
}
m=n;
while( m != 0) {
rem=m % 10;
// store the sum of the power of individual digits in arm
arm+= pow(rem,i);
m=m/10;
}
// if n is equal to arm, the number is an Armstrong number
if (arm== n){
printf("%d is an Armstrong number.", n);
}
else
printf("%d is not an Armstrong number.", n);
return 0;
}
40.Switch case (vowel & consonant)
#include<stdio.h>
int main()
{char ch;
printf("enter any alphabet:\n");
scanf("%c",&ch);
switch(ch)
{
case 'a': printf(" %c is vowel",ch);
break;
case 'e': printf("%c is vowel",ch);
break;
case 'i': printf("%c is vowel",ch);
break;
case 'o': printf("%c is vowel",ch );
break;
case 'u': printf("%c is vowel",ch);
break;
case 'A': printf(" %c is vowel",ch);
break;
case 'E': printf(" %c is vowel",ch);
break;
case 'I': printf(" %c is vowel",ch);
break;
case 'O': printf(" %c is vowel",ch);
break;
case 'U': printf(" %c is vowel",ch);
break;
default: printf("%c is consonant",ch);
}
return 0;
}
41.switch case (weekday number)
#include<stdio.h>
int main()
{int n;
printf("enter any weekday number:\n");
scanf("%d",&n);
switch(n)
{
case 1: printf("MONDAY");
break;
case 2: printf("TUESDAY");
break;
case 3: printf("WEDNESDAY");
break;
case 4: printf("THURSDAY");
break;
case 5: printf("FRIDAY");
break;
case 6: printf("SATURDAY");
break;
case 7: printf("SUNDAY");
break;
default: printf("enter valid weekday number");
}
return 0;
}
42.switch case (simple calculator)
#include<stdio.h>
int main()
{
char operator;
float a,b;
printf("enter any simple operator:");
scanf("%c",&operator);
printf("enter two operands:");
scanf("%f %f",&a,&b);
switch(operator)
{
case '+': printf("the sum is %.2f",a+b);
break;
case '-': printf("the difference is %.2f",a-b);
break;
case '*': printf("the product is %.2f",a*b);
break;
case '/': printf("the quotient is %.2f",a/b);
break;
default: printf("operator not available");
}
return 0;
}
43.switch case (month days)
#include<stdio.h>
int main()
{int mn;
printf("enter month number:");
scanf("%d",&mn);
switch (mn)
{
case 1: printf("January has 31 days");
break;
case 2: printf("February has 28 days");
break;
case 3: printf("March has 31 days");
break;
case 4: printf("April has 30 days");
break;
case 5: printf("May has 31 days");
break;
case 6: printf("June has 30 days");
break;
case 7: printf("July has 31 days");
break;
case 8: printf("August has 31 days");
break;
case 9: printf("September has 30 days");
break;
case 10: printf("October has 31 days");
break;
case 11: printf("November has 30 days");
break;
case 12: printf("December has 31 days");
break;
}
return 0;
}
44.print all elements of array
#include<stdio.h>
int main()
{
int arr[10] = {1,2,3,4,5,6,7,8,9,10};
int loop;
for(loop=0;loop <10;loop++)
printf("%d ",arr[loop]);
return 0;
}
45.addition and subtraction of 2 D arrays
//C Multidimensional Arrays
//Program to Add Two Matrices
#include <stdio.h>
int main() {
int r, c, a[5][5], b[5][5], sum[5][5],diff[5][5], i, j;
printf("For any two square matrix\n");
printf("Enter no.of of rows and columns (between 1 and 5): ");
scanf("%d %d", &r,&c);
printf("\nEnter elements of 1st matrix:\n");
printf("Enter %d * %d elements:\n",r,c);
for (i = 0; i < r; ++i)
for (j = 0; j < c; ++j) {
scanf("%d", &a[i][j]);
}
printf("Enter elements of 2nd matrix:\n");
printf("Enter %d * %d elements:\n",r,c);
for (i = 0; i < r; ++i)
for (j = 0; j < c; ++j) {
scanf("%d", &b[i][j]);
}
// adding and subtracting two matrices
for (i = 0; i < r; ++i)
for (j = 0; j < c; ++j) {
sum[i][j] = a[i][j] + b[i][j];
diff[i][j] = a[i][j] - b[i][j];
}
// printing the result
printf("\nSum of two matrices: \n");
for (i = 0; i < r; ++i)
for (j = 0; j < c; ++j) {
printf("%d ", sum[i][j]);
if (j == c - 1) {
printf("\n\n");
}
}
printf("\ndifference of two matrices: \n");
for (i = 0; i < r; ++i)
for (j = 0; j < c; ++j) {
printf("%d ", diff[i][j]);
if (j == c - 1) {
printf("\n\n");
}
}
return 0;
}
46.sum and average of elements of array.
#include <stdio.h>
int main() {
int n, i;
float num[10], sum = 0.0, avg;
printf("Enter the numbers of elements: ");
scanf("%d", &n);
while (n > 10 || n < 1) {
printf("Error! number should in range of (1 to 10).\n");
printf("Enter the number again: ");
scanf("%d", &n);
}
printf(" Enter numbers : ");
for (i = 0; i < n; ++i) {
scanf("%f", &num[i]);
sum += num[i];
}
avg = sum / n;
printf("Average = %.2f", avg);
return 0;
}
47.maximum and minimum of elements in the array.
#include<stdio.h>
int main()
{
int n;
printf("enter the no. of entities you want(less than 10;");
scanf("%d",&n);
int i,max,min;
int arr[n];
printf("enter the entities :\n");
for(i=0; i<n; i++) {
scanf("%d",&arr[i]);
}
max = arr[0];
min = arr[0];
//for maximum
for(i=1; i<n; i++)
{
if(arr[i]>max)
{
max = arr[i];
}
//for minimum
if(arr[i]<min)
{
min = arr[i];
}
}
printf("Maximum element is : %d\n", max);
printf("Minimum element is : %d\n\n", min);
}
48. Descending order of array elements.
#include <stdio.h>
void main ()
{
int i, j, a, n;
printf("Enter the no.of numbers :\n");
scanf("%d", &n);
int number[n];
printf("Enter the numbers \n");
for (i = 0; i < n; ++i)
scanf("%d", &number[i]);
/* sorting begins ... */
for (i = 0; i < n; ++i)
{
for (j = i + 1; j < n; ++j)
{
if (number[i] < number[j])
{
a = number[i];
number[i] = number[j];
number[j] = a;
}
}
}
printf("The numbers arranged in descending order are given below\n");
for (i = 0; i < n; ++i)
{
printf("%d > ", number[i]);
}
}
49.ascending order of array elements.
#include <stdio.h>
void main ()
{
int i, j, a, n;
printf("Enter the no.of numbers :\n");
scanf("%d", &n);
int number[n];
printf("Enter the numbers \n");
for (i = 0; i < n; ++i)
scanf("%d", &number[i]);
/* sorting begins ... */
for (i = 0; i < n; ++i)
{
for (j = i + 1; j < n; ++j)
{
if (number[i] > number[j])
{
a = number[i];
number[i] = number[j];
number[j] = a;
}
}
}
printf("The numbers arranged in ascending order are given below\n");
for (i = 0; i < n; ++i)
{
printf("%d < ", number[i]);
}
}
50.sorting of odd and even elements in an array.
#include<stdio.h>
int main()
{
int arr1[10],arr2[10],arr3[10],n,i,j=0,k=0;
printf("enter the no.of elements you want:\n");
scanf("%d",&n);
printf("Enter the elements:\n");
for(i=0; i<n; i++) {
scanf("%d",&arr1[i]);
}
for(i=0; i<n; i++) {
if(arr1[i] % 2 == 0) {
arr2[j]=arr1[i];
j++;
}
else {
arr3[k] = arr1[i];
k++;
}
}
printf("\nthe even nos.are:\n");
for(i=0; i<j; i++) {
printf("%d ",arr2[i]);
}
------- The end ---------
printf("\nthe odd nos are :\n ");
for(i=0; i<k; i++) {
printf("%d ",arr3[i]);
}
return 0;
}



Sobh ki tui korsos ni ??😁
ReplyDelete