పోస్ట్‌లు

Assignment అసైన్మెంట్ for getting eligibility for industrial visit/ iit tech fest visit/ other benefits

మీకు ప్రస్తుతం ఉన్న సబ్జెక్టుల్లో పది మార్కుల విలువ చేసేలా థియరీ ప్రశ్న(లు) వాటి జవాబు(లు) ఆడియో రికార్డ్ చేసి vignanwiki@gmail.com కి వీలైనంత త్వరలో పంపాలి. ఆడియో మొదట్లో మీ పేరు రోల్ నెంబర్ చెప్పండి. చెప్పాల్సిన విషయం ఐదు నిమిషాల కన్నా ఎక్కువ  ఉన్నచో మొదటి భాగం రెండవ భాగం.. ఇలా ఒక్కోటి ఐదు నిమిషాలు దాటకుండా చేయండి  లేదా ఒక నీతి కథ. అసైన్మెంట్ లో భాగంగా ఫలానా తేదీన రికార్డ్ చేస్తున్నా అని చెప్పాలి 

100% recursion function to get hEmachandra (/fibonacci) series

// Online C compiler to run C program online #include"stdio.h" int fibonacci(int n) {    if (n==0        return 0; else if n==1    return 1; else  return (fibonacci(n-1) + fibonacci(n-2)); } int main() {     int  i,p, temp;     printf("\n enter no of terms required in hemachandra series:");     scanf("%d",&p);     for(i=0;i<p;i++)       {           temp=  fibonacci(i);           printf("\n %d",temp); } } తెరమీద  enter no of terms required in hemachandra series:7 0  1  1  2  3  5  8

100% Advantage of pointers..an illustration

/*re-assigning a different name to a char array not possible directly but similar thing can be achieved with pointers*/ #include<stdio.h> void main() {   char a[ ]="SATYAMU";   char *p="cheppu";   char *t;   t=p;   //a="cheppu"; /*  if the above line is not commented then we will get error, bcoz a is already assigned a string SATYAMU and new assignment with other name is not acceptable*/   printf("%s, %d",t, *t);   printf("\n %s, %d",p, *p); } తెరమీద cheppu, 99  cheppu, 99 గమనిక ... ఇక్కడ 99అనేది cheppuలో మొదటి అక్షరమైన c యొక్క ASCII విలువ.  'a' యొక్క ASCII విలువ 97 అని మీకు తెలుసు!. 

100% prog to copy contents of one structure variable to another variable of same structure

#include <stdio.h> #include<stdlib.h> void main() {     struct employee     {         int service_years;         char name[17];         float salary; // after deducting tax     }e,duplicate; //to store three dates     printf("\n enter service years (integer), name (string without space) and salary (float):");     scanf("%d%s%f",&e.service_years, e.name ,&e.salary);     duplicate=e;     printf("\n");     printf("\n\n service_years=%d \n name=%s \n salary=%f",duplicate.service_years, duplicate.name ,duplicate.salary); }      తెరమీద  enter service years (integer), name (string without space) and salary (float):4 vishNu 12324.50 service_years=4  name=vishNu  salary=12324.500000

100% prog to know how much memory struct variable takes

చిత్రం
/* program to understand how memory is alloted for strutures*/ #include <stdio.h> #include<stdlib.h> void main() {     struct date     {         int day, month, year;         char week_day;     }d[3]; //to store three dates     int i;     for(i=0;i<3;i++)     {         printf("\n starting addresses of d[%d].day=%u, d[%d].month=%u,d[%d].char=%u",i,&d[i].day,i,&d[i].month,i,&d[i].week_day);     }     printf("\n starting address of d[0] is %u and d[1] is %u", &d[0], &d[1]);     printf("\n size of 1 structure variable=%d",sizeof(d[0])); }      

100% program to insert a element from given location in the array

#include <stdio.h> void main() {     int a[20],i,n,location, nayA;     printf("\n enter no of elements in the array with max limit of 19:"); /*the max limit u enter should be 1 less than array size (of 20) used (here) in the initial declaration becoz after inserting the element overall size should not cross initially declared size, which is 20 here*/     scanf("%d",&n);     for(i=0;i<n;i++)     {         printf("\n enter the (integer) element a[%d]:",i);         scanf("%d",&a[i]);     }     printf("\n enter the location where new element has to be inserted:");     scanf("%d",&location);     printf("\n enter the integer element to be inserted:");     scanf("%d",&nayA);     for(i=n;i>=location;i--)      a[i]=a[i-1]; //shifting the elements     a[location-1]=nayA;     printf("\n the elements in the array after deletion of 1 element are:\n");     for(i=0;i<=n;i++) // now...

100% program to delete a element from given location in the array

#include <stdio.h> void main() {     int a[20],i,n,location;     printf("\n enter no of elements in the array with max limit of 20:");     scanf("%d",&n);     for(i=0;i<n;i++)     {         printf("\n enter the (integer) element a[%d]:",i);         scanf("%d",&a[i]);     }     printf("\n enter the location of the element to be deleted:");     scanf("%d",&location);     for(i=location-1;i<n;i++)      a[i]=a[i+1]; //shifting the elements         printf("\n the elements in the array after deletion of 1 element are:\n");     for(i=0;i<n-1;i++) // now the array size decreased by 1 so (n-1)      printf("a[%d]=%-4d    ",i,a[i]); }      తెరమీద  enter no of elements in the array with max limit of 20:4 enter the (integer) element a[0]:2 enter the (integer) element a[1]:5 enter the (integer) element a[2]:8 enter the (integer) element a[3]:-1 enter the location of the element to be deleted:3 ...